PHP 4.0 Bug #1975 Updated: A recursive function is not acting correctly in 4.0b2 that works fine in 3.0

From: Date: Fri, 06 Aug 1999 17:52:12 +0000
Subject: PHP 4.0 Bug #1975 Updated: A recursive function is not acting correctly in 4.0b2 that works fine in 3.0
Groups: php.dev 
Request: Send a blank email to php-dev+get-9604@lists.php.net to get a copy of this message
ID: 1975 Updated by: zeev Reported By: mstearne@eisolutions.com Status: Closed Bug Type: Other Assigned To: Comments: This is an undocumented incompatibility with PHP 3.0, for an undocumented behavior of unset(). unset() in PHP 3.0 caused the variable, and any variables that may have pointed to it, to become unset. There wasn't much of a notion of references in PHP 3.0, but you could still have variables pointing at each other in two cases - global variables (local variables pointing at global variables) and variables that are passed by reference. This behavior was a side effect of implementation. With PHP 4.0, the definition of unset() is very strict. Simply put - it means 'remove that symbol'. So, in your code, unset($final) tells PHP to remove the symbol 'final', which is a local symbol pointing to the global symbol with the same name. What happens is that only the local reference gets deleted, and throughout the rest of the function, whenever you reference $final, you reference a local variable. If you actually want to unset() the global symbol $final, you have to unset $GLOBALS["final"] instead. But in your case, I think you can do with simply assigning "" into $final (or rely on the default value, which is "" anyway). Full Bug description available at: http://bugs.php.net/version4/?id=1975

« previous php.dev (#9604) next »