PHP 4.0 Bug #8378: unsetting a global array
| From: | superfly at jocose dot net | Date: | Fri, 22 Dec 2000 18:57:56 +0000 |
| Subject: | PHP 4.0 Bug #8378: unsetting a global array | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-42128@lists.php.net to get a copy of this message | ||
From: superfly@jocose.net
Operating system: RedHat 7.0
PHP version: 4.0.3pl1
PHP Bug Type: Arrays related
Bug description: unsetting a global array
<?
function unsetArray()
{
global $array;
unset($array);
}
$array[0] = "foo";
$array[3] = "bar";
unsetArray();
$array[1] = "new";
$array[2] = "data";
?>
This will set $array up like this:
$array[0] = "";
$array[1] = "new";
$array[2] = "data";
$array[3] = "";
However:
<?
function unsetArray()
{
unset($GLOBALS["array"]);
}
$GLOBALS["array"][0] = "foo";
$GLOBALS["array"][3] = "bar";
unsetArray();
$GLOBALS["array"][1] = "new";
$GLOBALS["array"][2] = "data";
?>
will set up an array like this:
$array[1] = "new";
$array[2] = "data";
--
Edit Bug report at: http://bugs.php.net/?id=8378&edit=1