From: kingoleg at mail dot ru
Operating system: All
PHP version: 4.3.8
PHP Bug Type: Scripting Engine problem
Bug description: unset( $GLOBALS['foo']); unset only global variable, not variables
that REFERED
Description:
------------
unset( $GLOBALS['foo']); unset only global variable, not variables that
REFERED to global variable
How we can unset global variable with all referenced variable using
unset() function? Do we must user assign to null?
Reproduce code:
---------------
<?php
function a( &$foo) {
$foo = 'ok';
b( $foo);
var_dump( $foo);
}
function b( &$foo) {
$foo = 'not ok';
unset( $GLOBALS['foo']);
}
global $foo;
$foo = 'global';
a($foo);
var_dump( $foo);
?>
Expected result:
----------------
NULL NULL
Actual result:
--------------
string(6) "not ok" NULL
--
Edit bug report at http://bugs.php.net/?id=29429&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29429&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29429&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29429&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29429&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29429&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29429&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29429&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29429&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29429&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29429&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29429&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29429&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29429&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29429&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29429&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29429&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29429&r=float