|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-01-09 19:46 UTC] iliaa@php.net
[2003-01-13 03:28 UTC] peton at cavalex dot com
[2003-01-14 19:14 UTC] mmm at plesk dot com
[2003-01-17 12:44 UTC] angelo at ispl dot ca
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 15:00:02 2025 UTC |
Hi, a strange problem, with session and register_global. The problem does not exist with PHP-4.2.3. When you have a variable set to a undefined value of $_SERVER array, and register_global set to ON, PHP set all variables to the same value (the last value). If you reload the page, there is no problem, it is only the FIRST time you read the page where there is the session variable is built. If you try with an unset variable, there is no problem. By the way, I don't understand the last message about "Your script possibly relies on a session side-effect..." when register_global is set to OFF. Best Regards, Nicolas --- info PHP PHP Version 4.3.0 register_argc_argv On session.auto_start Off session.bug_compat_42 On session.bug_compat_warn On session.cookie_domain no value session.name PHPSESSID session.use_cookies On session.use_only_cookies Off session.use_trans_sid Off -------------- test.php ------------- +++SCRIPT+++ session_start(); $referer=$_SERVER['HTTP_REFERER']; # ERR (first time) #$referer="----"; # OK (always) session_register("referer"); echo "<PRE>"; echo session_encode(); echo "</PRE>"; $var1="V1"; $var2="V2"; $var3="V3"; echo "<BR>$var1 -- $var2 -- $var3 -- $var_not_affected\n"; +++ ------- WITH register_global : On At the first execution of ths script: +++OUTPUT+++ referer|N; V3 -- V3 -- V3 -- V3 +++ AND after reload: +++OUTPUT+++ referer|N; V1 -- V2 -- V3 -- +++ ------- WITH register_global : Off +++OUTPUT+++ referer|N; V1 -- V2 -- V3 -- 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 +++