Date: 12/05/00
- Next message: Bernd Nies: "[PHP-DEV] Re: PHP 4.0 Bug #5394 Updated: Linking problem with libphp4.a and libmodphp4.a"
- Previous message: christian <email protected>: "[PHP-DEV] PHP 4.0 Bug #8115: variable passed by reference incorrectly handled"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 8115
Updated by: stas
Reported By: christian <email protected>
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
This is exactly as it is meant to work. Please read
"References explained" in the manual. When you do the unset,
you effectively destroy local variable $a, breaking the
reference. Now when you mention $a again, it's not
referenced to $my_var anymore - it's a new variable.
Previous Comments:
---------------------------------------------------------------------------
[2000-12-05 06:27:46] christian <email protected>
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 = "").
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8115
-- 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>
- Next message: Bernd Nies: "[PHP-DEV] Re: PHP 4.0 Bug #5394 Updated: Linking problem with libphp4.a and libmodphp4.a"
- Previous message: christian <email protected>: "[PHP-DEV] PHP 4.0 Bug #8115: variable passed by reference incorrectly handled"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

