Welcome to WebmasterWorld Guest from 184.73.3.107

Forum Moderators: coopster & jatar k

Warning: Unknown(): Your script possibly relies on a session

side-effect which existed until PHP 4.2.3.

   
8:04 pm on Sep 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm getting a strange error in one of my programs:

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

Funny thing is I'm not using any globals at all in my script, but I am using $_SESSION. I even did grep GLOBAL *.php in my directory in case it's in one of the functions I included and nothin'. Strangely the error is output at the very end of the code (after a simple print statement which is before the closing php tag). I don't see the point in messing with register_globals when I don't use globals so am hoping for another solution. Any ideas?
8:19 pm on Sep 15, 2006 (gmt 0)

5+ Year Member



Add this to your php.ini and restart Apache:

session.bug_compat_warn to off

Or add the following to the .htaccess file

php_flag session.bug_compat_warn off
8:22 pm on Sep 15, 2006 (gmt 0)

WebmasterWorld Senior Member eelixduppy is a WebmasterWorld Top Contributor of All Time 5+ Year Member




PHP versions 4.2.3 and lower have an undocumented feature/bug that allows you to initialize a session variable in the global scope, albeit register_globals is disabled. PHP 4.3.0 and later will warn you, if this feature is used, and if session.bug_compat_warn is also enabled. This feature/bug can be disabled by disabling this directive.

[php.net...]

I don't think it will cause any harm, but if you want, change your script.

Best of luck! ;)

10:14 pm on Sep 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the info. Thing is I want the script to be portable without having to change register_globals and also I don't actually want to use globals.

Woah, just found the problem. I kept putting in die statements in my code starting at the end and moving up until I isolated the line that triggered the error (error was being shown at end but actually being triggerd somewhere in the middle). I was setting a certain variable, non global, non session. I re-named the variable and the error goes away. I'm using PEAR so my guess is there is an identical variable in PEAR in the global scope or something. Jeesh.

10:21 pm on Sep 15, 2006 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



gee physics, you should know by now that PEAR sucks ;)
5:07 pm on Sep 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Guess I've just been lucky till now jatar_k ;)
5:15 pm on Sep 16, 2006 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I have seen that one often when you are somewhere declaring or re-declaring a session that has no persistence. Re-check each session declared and how they are passed.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month