Jump to content

Recommended Posts

I've got pretty good at tracking down errors, and learning what errors mean, but I got this one today, and I'm wondering what it means:

 

[07-May-2009 23:11:00] PHP 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

Link to comment
https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/
Share on other sites

Id rather find out what is causing the problem, if possible. I'm wondering what kind of code triggers this error. If I know, then I can probably fix it. How would a person initialize a session variable in the global scope? This is apparently what is causing the error, but I'm not sure what that means.

The error occurs when you create/set a program variable or a session variable to a null value and there is both a program variable and a session variable with the same name. I am pretty sure the error message is not generated when the value is not null.

 

Like the error message states, this was a bug in php. Some of the register_globals code was still setting program and session variables when a null value was involved when register_globals were off. When they fixed the bug, they added the error message in case you were a lazy-programmer and relied on this action to set both program and session variables with the same name to the null value when you created/set one of them.

Id rather find out what is causing the problem, if possible. I'm wondering what kind of code triggers this error. If I know, then I can probably fix it. How would a person initialize a session variable in the global scope? This is apparently what is causing the error, but I'm not sure what that means.

 

It's a bug in PHP.....

I did have a session variable that I was setting to null, and it was the same name as a post variable. Basically, I was setting a token for a contact form, and after the form was submitted successfully, I wanted to make sure that the user couldn't resubmit by hitting the back button or refreshing the browser. So, I just set it to 'no duplicates please', and all is well.

 

Thanks for your help.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.