#24270 [NEW]: unset($var) doesn't unset session value with register_globals on

From: Date: Fri, 20 Jun 2003 16:53:03 +0000
Subject: #24270 [NEW]: unset($var) doesn't unset session value with register_globals on
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42279@lists.php.net to get a copy of this message
From: kjohnson at zootweb dot com Operating system: Linux PHP version: 4.3.2 PHP Bug Type: Session related Bug description: unset($var) doesn't unset session value with register_globals on Description: ------------ This is related to bug #19586 and only applies when register_globals is "on". If a global variable is registered to the session, then an unset() on that global variable will unset it on the current page, but its original value is restored on the next session_start(). I expected it to also be unset in the session, which is how it behaved in older versions of PHP. The workaround provided in bug #19586, unset($var, $_SESSION['var']), does work. However, this means that older code written for register_globals "on" may behave differently when moved to newer PHP versions, a subtle bug. It would be helpful if the code was fixed or the documentation updated to make folks aware of this potential problem. Reproduce code: --------------- file: test.php <? session_start(); $a = 'zero'; session_register('a'); unset($a); ?> <br><a href='./test2.php'>next</a> file: test2.php <? session_start(); echo "a is $a<br>"; ?> Expected result: ---------------- I expected $a to not have a value on test2.php, which is the case for this same code running on PHP 4.0.6. Actual result: -------------- On the second page, test2.php, $a has the value 'zero', as originally assigned on the first page. -- Edit bug report at http://bugs.php.net/?id=24270&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=24270&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=24270&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24270&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24270&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24270&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=24270&r=support Expected behavior: http://bugs.php.net/fix.php?id=24270&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=24270&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=24270&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24270&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24270&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24270&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24270&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=24270&r=gnused

« previous php.bugs (#42279) next »