Welcome to WebmasterWorld Guest from 54.224.160.42

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2548
votes: 0


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 Sept 15, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 17, 2006
posts:195
votes: 0


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 Sept 15, 2006 (gmt 0)

Senior Member

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

joined:Nov 12, 2005
posts:5966
votes: 0



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 Sept 15, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2548
votes: 0


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 Sept 15, 2006 (gmt 0)

Administrator

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

joined:July 24, 2001
posts:15755
votes: 0


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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 27, 2001
posts:2548
votes: 0


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

Senior Member from US 

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

joined:Apr 19, 2003
posts:4395
votes: 2


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.