From: tedd on 7 Feb 2010 13:11
At 10:15 AM -0600 2/7/10, Shawn McKenzie wrote:
>> Has anyone encountered this warning?
>> Warning: Unknown: Your script possibly relies on a session side-effect
>> which existed until PHP 4.2.3. Please be advised that the session
>> extension does not consider global variables as a source of data, unless
>> register_globals is enabled. You can disable this functionality and this
>> warning by setting session.bug_compat_42 or session.bug_compat_warn to
>> off, respectively in Unknown on line 0
>> I seem to remember this happening before, but I don't remember the
>> solution. As I remember, it wasn't really reporting an error, but
>> something else. I just don't remember how I dealt with it before.
>> I don't know how to set session.bug_compat_warn to off.
>> Any ideas?
>> PS: I'm using php 5.2.10 and register_global is OFF.
>This will reproduce the error:
>$_SESSION['test'] = null;
>$test = 1;
>It has something to do with using a global var that is the same name as
>a session var, but the session var has to be null it seems.
That's it! I remember now. I knew it was something simple and really stupid.
As it turns out, the problem here is that this error is NOT
consistent. Most of the time you don't need to worry about what you
name your variables and session variables. But every once in a while
if you are in the habit of naming variables the same name as session
variable (as I do), then the practice sometimes generates an error.
So to solve the above problem, all you have to do is use a different
variable name than the session name for that instance -- something
$_SESSION['session_test'] = null;
$test = 1;
But like I said, the error is only generated every once in a while
and NOT consistently. As such, you may have scores of variables that
match scores of sessions with no errors. But then you add just one
more and bingo you have an error that leaves you thinking "What the
Hell just happened?"
What is further maddening is that after you fix that error, by
changing then name of that conflict, you can go back to naming as you
like until another error is generated. It happens only once in a
while and not always.
Thanks for loaning me your memory.
http://sperling.com http://ancientstones.com http://earthstones.com