[PHP-DEV] PHP 4.0 Bug #8937 Updated: unset() in context with GLOBAL From: jmoore <email protected>
Date: 01/26/01

ID: 8937
Updated by: jmoore
Reported By: aulbach <email protected>
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:

Thats thanks to Bjorn ;) Not my sig..

Previous Comments:
---------------------------------------------------------------------------

[2001-01-26 11:52:29] jmoore <email protected>
Have a closer look at

   http://bugs.php.net/bugs.php?id=1971

and the commentary of Zeev. You have to
use unset($GLOBALS["x"]);

-- 
Björn Schotte                        b.schotte <email protected>
http://rent-a-phpwizard.de/          bjoern <email protected>

---------------------------------------------------------------------------

[2001-01-26 10:25:19] aulbach <email protected> unset() in context with GLOBAL has a serious bug. This bug appeard, when I changed a PHP3-program to PHP4. The problem is now, that constructs like the following are several times in this old program.

Sorry, I haven't checked, if this problem is fixed in 4.0.4. If so, perhaps someone can tell me? TIA.

Think this problem depends Zend, cause ZEND_CHANGES tells me:

"unset() is no longer a function, but a statement. It was never documented as a function so the impact should be no bigger than nada."

I have made a test-case:

<?

function test1 ($dir) { GLOBAL $x; unset($x); $x[$dir]=true; mydirname($dir); }

function test2 ($dir) { GLOBAL $x; ####### unset($x); no unset! $x[$dir]=true; mydirname($dir); }

function mydirname ($dir) { GLOBAL $x; $dir=ereg_Replace('/[^/]*$','',$dir); if (!empty($dir)) { echo "'$dir'<br>"; flush(); mydirname($dir); $x[$dir]=true; } }

$dir="/hugo/bla/fasel/test"; # first char must be '/' !

unset($x); test1($dir); echo "DIRS called with function test1(): "; print_r($x);

echo "<br>";

unset($x); test2($dir); echo "DIRS called with function test2(): "; print_r($x);

?>

---------------------------------------------------------------------------

Full Bug description available at: http://bugs.php.net/?id=8937

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>