php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25739 inappropriate session.compat_42 warning
Submitted: 2003-10-02 22:25 UTC Modified: 2003-10-04 00:04 UTC
From: webteam at skimtta dot com Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.4RC1 OS: W2K Pro, FreeBSD
Private report: No CVE-ID: None
 [2003-10-02 22:25 UTC] webteam at skimtta dot com
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


Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-04 00:04 UTC] sniper@php.net
Read the error message again:

"Your script possibly relies on.." <-- notice the word 'possibly'

You can silence the message by disabling either session.bug_compat_warn or session.bug_compat_42 or both.

Read also the note in php.ini-dist above these options.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Aug 22 18:01:28 2024 UTC