sKunKbad Posted May 8, 2009 Share Posted May 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/ Share on other sites More sharing options...
allworknoplay Posted May 8, 2009 Share Posted May 8, 2009 Yeah, old issue. Just go to your PHP.ini and add this. session.bug_compat_42 = 0; session.bug_compat_warn = 0; Quote Link to comment https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/#findComment-829789 Share on other sites More sharing options...
sKunKbad Posted May 9, 2009 Author Share Posted May 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/#findComment-829972 Share on other sites More sharing options...
PFMaBiSmAd Posted May 9, 2009 Share Posted May 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/#findComment-830011 Share on other sites More sharing options...
allworknoplay Posted May 9, 2009 Share Posted May 9, 2009 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..... Quote Link to comment https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/#findComment-830029 Share on other sites More sharing options...
sKunKbad Posted May 9, 2009 Author Share Posted May 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/157405-solved-error-in-unknown-on-line-0/#findComment-830138 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.