Re: sessions and global register

From: Date: Mon, 03 Feb 2003 17:06:14 +0000
Subject: Re: sessions and global register
Groups: php.windows 
Request: Send a blank email to php-windows+get-18325@lists.php.net to get a copy of this message
First of all, you can make sessions automaticly turn on by setting "session.auto_start" in your php.ini file. Alternatively, you can set "output_buffering" to something... to buffer your response before sending it along. Now, that error message you are getting is probably because you are trying to put one of the global variables into session. Its a complex issue, but basicly there are scoping problems with global variables and sessions. Im not sure why: http://bugs.php.net/bug.php?id=21312 This problem was, in theory, fixed with 4.3, but a lot of people still see wierd problems. You should just be sure to NEVER put a global object in a session... which means not putting ANYTHING in there from the $_SERVER superglobal, or even from things like the $_POST superglobal, unless you first alter its scope. The above URL has a trick to do this. happy coding! -- Brian 'Bex' Huff bex@stellent.com Phone: 952-903-2023 Fax: 952-829-5424 > Hi > I've been learning to get through sessions as it appears to be the hardest > part of PHP I've come across. > > I found that includes must be stated underneath that of a session_start() > for example otherwise a warning will appear that it can't start a session > because a header has already been sent (or something to that effect). > > But a new warning has arose where it is suggesting something, but please > note that the code actually executed okay. So, I want to clarify it's > meaning and is it safe to just turn of the warning(session.bug_compat_warn ) > and do nothing else? (I'm using v 4.3) > > 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 > > Regards, Pat

« previous php.windows (#18325) next »