ID:               21312
 Comment by:       adam at forsalebyowner dot com
 Reported By:      charlesk at netgaintechnology dot com
 Status:           Closed
 Bug Type:         Session related
 Operating System: Windows 2000 Server
 PHP Version:      4.3.0
 New Comment:

On Linux 2.4x and Apache 1.3.27 with mod_perl and php 4.3.2 or 4.3.1, I
get the same thing.  The root of the problem for me was the variable
used:


$iAccountNumber     = $_POST['iAccountNumber'];
$_SESSION['iAccountNumber']     = $iAccountNumber;

throws out that error if the previous page does not have a post field
for iAccountNumber.  Man, this took forever to figure out.  The funny
thing is that the first line survives, it's the second one that makes
the error spit out (assumedly because $iAccountNumber never gets set). 
Neither of the session.bug_compat_42 or session.bug_compat_warn has any
effect.


Previous Comments:
------------------------------------------------------------------------

[2003-05-21 15:51:14] bex at bex dot ca

I've had this same problem.  It came from setting session variables and
worked fine in older versions of PHP but started giving me the
mentioned error when PHP hit version 4.3.1.

<?
global $my_session_variable;
session_register("my_session_variable");
?>

OUTPUT HTML:
"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"

This comes from a misconception that you have to set a variable to
global before it can be registered as a session.

Hope this helps in any way.

------------------------------------------------------------------------

[2003-05-10 19:31:20] [EMAIL PROTECTED]

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.



------------------------------------------------------------------------

[2003-03-25 09:01:36] roland at web dot co dot th

Yes, it appears that
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
is currently the most efficient work-around until the developers come
up with a response.

Has anyone a snipset how to code the sessions "clear" without causing
that message at all?

------------------------------------------------------------------------

[2003-03-23 17:05:06] nez at irc dot pl

I've set:
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
(even with error_reporting = E_ERROR it works ok)
and there's no more that problem - i mean no warning:

"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"

Or.. you can always set register_globals = Off ... ;-)

------------------------------------------------------------------------

[2003-03-18 08:51:59] s at nospam dot org

still it is in the latest cvs and snaps. this problem being ignored?

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/21312

-- 
Edit this bug report at http://bugs.php.net/?id=21312&edit=1

Reply via email to