homepage Welcome to WebmasterWorld Guest from 54.211.7.174
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Warning: Unknown(): Your script possibly relies on a session
side-effect which existed until PHP 4.2.3.
physics




msg:3084804
 8:04 pm on Sep 15, 2006 (gmt 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?

 

Psychopsia




msg:3084821
 8:19 pm on Sep 15, 2006 (gmt 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

eelixduppy




msg:3084822
 8:22 pm on Sep 15, 2006 (gmt 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! ;)

physics




msg:3084936
 10:14 pm on Sep 15, 2006 (gmt 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.

jatar_k




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

gee physics, you should know by now that PEAR sucks ;)

physics




msg:3085634
 5:07 pm on Sep 16, 2006 (gmt 0)

Guess I've just been lucky till now jatar_k ;)

henry0




msg:3085644
 5:15 pm on Sep 16, 2006 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved