#24270 [Opn->Bgs]: Apache child process segfaults or bus error whil trying to use graph functions

From: Date: Fri, 20 Jun 2003 19:01:27 +0000
Subject: #24270 [Opn->Bgs]: Apache child process segfaults or bus error whil trying to use graph functions
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42284@lists.php.net to get a copy of this message
ID: 24270 Updated by: derick@php.net -Summary: unset($var) doesn't unset session value with register_globals on Reported By: kjohnson at zootweb dot com -Status: Open +Status: Bogus Bug Type: Session related -Operating System: Linux +Operating System: Solaris 8 & 9 PHP Version: 4.3.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is expected behavior though. session_register only makes a reference to the global variable. When you unset it, the session still holds the 2nd reference to the data, and thus is it still set. Previous Comments: ------------------------------------------------------------------------ [2003-06-20 11:53:03] kjohnson at zootweb dot com 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 this bug report at http://bugs.php.net/?id=24270&edit=1

« previous php.bugs (#42284) next »