From:             webteam at skimtta dot com
Operating system: W2K Pro, FreeBSD
PHP version:      4.3.4RC1
PHP Bug Type:     Session related
Bug description:  inappropriate session.compat_42 warning

Description:
------------
Session.compat_42 warning message is reported without using global
variables as a source of data.  Register globals are off.  

This warning message occurs when a local variable and a session variable
have the same name, and the session variable ends up being assigned a NULL
value - see code below.  (Note: I'm not trying to unset the session
variable. In my real code, the NULL result came from several levels of
nested function calls).

This warning message states "...the session extension does not consider
global variables as a source of data, unless register_globals is enabled".
 This does not describe this siutation.

The documentation doesn't state that local variables and session variables
must not have the same name; and the comp_42 warning message does not
cover this case either.  So this must be a bug.







Reproduce code:
---------------
    session_start();

    // WORKS:
    //   $x = 1; 
    //   $_SESSION["x"] = "";   
    // or
    //   $_SESSION["x"] = NULL;   

    // FAILS with session.bug_compat_42 warning: 
       $x = 1; 
       $_SESSION["x"] = NULL; 


Expected result:
----------------
No warning messages and not having to disable warning messages that do not
describe this situation.  (Or changes to the documentation stating "local
variables and session variables can not have the same names").

Actual result:
--------------
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


-- 
Edit bug report at http://bugs.php.net/?id=25739&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25739&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25739&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25739&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25739&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25739&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25739&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25739&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25739&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25739&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25739&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25739&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25739&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25739&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25739&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25739&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25739&r=float

Reply via email to