PHP 4.0 Bug #8115: variable passed by reference incorrectly handled
| From: | christian at architech dot no | Date: | Tue, 05 Dec 2000 11:27:46 +0000 |
| Subject: | PHP 4.0 Bug #8115: variable passed by reference incorrectly handled | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-40109@lists.php.net to get a copy of this message | ||
From: christian@architech.no
Operating system: linux
PHP version: 4.0.2
PHP Bug Type: Scripting Engine problem
Bug description: variable passed by reference incorrectly handled
It concerns variables passed by reference... and the unset() function.
# Let's define a very simple function that converts an array to a string :
function foo(&$a)
{
$an_array = array("abcdef");
unset($a);
for ($i=0; $i<sizeof($an_array); $i++)
$a = $a . $an_array[$i];
}
# and call it :
foo($my_var);
# $my_var is NOT EQUAL TO "abcdef" !!!!!
However it works fine when we don't try to unset the $a variable. (replacing the line with $a =
"").
--
Edit Bug report at: http://bugs.php.net/?id=8115&edit=1