Re: Legal $_SESSION names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 2:25 PM +0100 5/23/09, Stuart wrote:
2009/5/22 tedd <tedd@xxxxxxxxxxxx>:
 > Regardless of what anyone may say to the contrary, it doesn't work
 everywhere. I found that out the hard way. The fix is simply to use a
 different name for the variable, such as:

 $my_var = $_SESSION['myvar'];

I'm just guessing but I'd say this has to do with the way superglobals
are created. Since 5.0.0 a configuration option called
auto_globals_jit has existed and it defaults to being on. It causes
the creation of superglobals to be delayed until they are actually
used. I don't know how it interacts with register_globals (the manual
says it'll be disabled if register_globals is on) but it makes sense
to me that this issue is related to that.

I'd say you've found a bug, but you'll need a repeatable example
before you can report it.

-Stuart

-Stuart:

I'm pretty sure it's a bug -- all of my scripts work and one doesn't within the same environment. I have a routine where an Administrator can bypass the logon procedures of a registered user to the site and see what the user sees.

To do that I simply use a bypass session variable namely:

$bypass = $_SESSION['bypass'];

I use this exact same statement in 13 different scripts and it works. However, in one script, I have to change the statement to:

$by_pass = $_SESSION['bypass'];

to make it work. Otherwise it fails with some vague error code about using something that has been depreciated.

Considering that the error is surrounded by so much code, I don't want to wade through it all and find the exact problem and report it. Instead, I'm just saying if someone runs into this problem like this, they might try changing the variable name. It's a simple fix, but it's hard to identify.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux