KBD

Keith Devens .com

Sunday, July 20, 2008 Flag waving
A charlatan makes obscure what is clear; a thinker makes clear what is obscure. – Hugh Kingsmill
← Entry 1686Entry 1688 →

Daily link icon Thursday, March 21, 2002

Entry 1687

I just noticed a boo boo when programming with PHP 4.1.0 or higher and using the new "super globals". Session variables (and cookie variables, but I use those less) seem to benefit the most from having an explicit $_SESSION in front of it to signify that it's coming from a session. It's not as clear otherwise.

My mistake, though, was that I used $_SESSION["varname"] and $varname as a post variable, thinking that they were different variables, when in reality, since REGISTER_GLOBALS is on, the fact that I had a session variable named $varname cancelled out the auto-registered session variable (EGPCS - session comes last), so $varname and $_SESSION["varname"] actually referred to the exact same variable Smiley Just something else to watch out for. I was able to get around it by just using the $_REQUEST["varname"] version, since that will refer to the post or get version instead of the session version.

← Entry 1686Entry 1688 →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

July 2008
SunMonTueWedThuFriSat
 12345
6789101112
13141516171819
20212223242526
2728293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 2 posts

Recent comments XML

Spider solitaire

To answer an earlier question, I am​almost certain every game can be​beat. ...

Jared: Jul 16, 2:20pm

I hate Norton Antivirus

I HATE NORTON ANTIVIRUS IT SUCKS I​GOT AVG IT ROX! AGES TO DELETE​NORTON AN...

wade: Jul 15, 1:44am

Generated in about 0.138s.

(Used 8 db queries)

mobile phone