#24380 [Bgs]: session side-effect bug

From: Date: Sun, 29 Jun 2003 03:59:49 +0000
Subject: #24380 [Bgs]: session side-effect bug
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42707@lists.php.net to get a copy of this message
ID: 24380 User updated by: akukin at ihug dot co dot nz Reported By: akukin at ihug dot co dot nz Status: Bogus Bug Type: Session related Operating System: win2k & linux PHP Version: 4.3.2 New Comment: >Just set "session.bug_compat_42 = 0" in your php.ini You are asking me to hide the bug (maybe my bug maybe PHP one). Of course I will do this for my little app when it i deployed but I just want this feature to be treated as BUG unless there is an explanation to it! I did try to set session.bug_compat_42 to OFF before submitting the bug report. Yes, it did hide it - but this is not a solution as the message clearly says I am doing the WRONG thing. So, what wrong thing (bug) am I doing??? And if none - it is clearly PHP bug. >And btw. correct way to unset session variables is to use 'unset()' Well, you are right that to unset the variable you use unset but what if I do not want to unset it but just want to NULL its value??? >and this error message actually tells you that you're doing >something wrong. What am I doing wrong? Should the warning let me know (at least) line number of the "wrong code"? I want to correct my code rather than "hide the bug" or I want to flag this PHP bug so that it is fixed in the subsequent PHP release Previous Comments: ------------------------------------------------------------------------ [2003-06-28 22:33:05] sniper@php.net Just set "session.bug_compat_42 = 0" in your php.ini. (or if you're using apache, in .htaccess file, using php_value) The error message clearly says: "..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.." And btw. correct way to unset session variables is to use 'unset()', and this error message actually tells you that you're doing something wrong. ------------------------------------------------------------------------ [2003-06-28 20:54:32] sniper@php.net Is register_globals on or off? Try this: <?php echo ini_get('register_globals'); ?> ------------------------------------------------------------------------ [2003-06-28 18:39:40] akukin at ihug dot co dot nz Description: ------------ 1. After running the following source code I get: ================================================ 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 ================================================ I expect no such warning as I am not using any register_globals etc I am only using the suggested session handling API: session_start & $_SESSION array. 2. Also found: By changing the last 2 lines to: //$_SESSION["test"] = NULL; unset($_SESSION["test"]); warning disappears. By changing "$test = " to "$test2 = " warning disappears either. Shall it be the feature I would appreciate if you send me an explanation of this feature as it does not make any sense to me. Reproduce code: --------------- <? session_start(); $test = isset($_SESSION["test"]) ? $_SESSION["test"] : "test"; $_SESSION["test"] = NULL; //unset($_SESSION["test"]); ?> Expected result: ---------------- I expect not to have this warning as I am not using any register_globals etc I am only using the suggested session handling API: session_start & $_SESSION array. 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 this bug report at http://bugs.php.net/?id=24380&edit=1

« previous php.bugs (#42707) next »