ID:               37141
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jazfresh at hotmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         *General Issues
 Operating System: Linux Fedora Core 5
 PHP Version:      5.1.2
 New Comment:

Add error_reporting(E_ALL|E_STRICT) to the beginning of your code and
you'll see the explanation.


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

[2006-04-20 04:50:40] jazfresh at hotmail dot com

Description:
------------
If a variable is initialized inside a function call (e.g. foo($bar,
$baz=3) ) and that parameter is a reference, then the variable cannot
be altered by the function. It works ok if the variable is initialized
outside the function call.

This bug exists in PHP 5.1.2. It does not exist in 5.0.3. I checked the
changelogs and release notes for all versions inbetween, but I did not
find anything that indicated that the language changed in this way.

Reproduce code:
---------------
function foo(&$bar) {
    echo "Parameter is $bar\n";
    $bar = "baz";
}

foo($woz = "abc");
echo "Woz is $woz\n";

$bliz = "abc";
foo($bliz);
echo "Bliz is $bliz\n";


Expected result:
----------------
Parameter is abc
Woz is baz
Parameter is abc
Bliz is baz


Actual result:
--------------
Parameter is abc
Woz is abc
Parameter is abc
Bliz is baz



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


-- 
Edit this bug report at http://bugs.php.net/?id=37141&edit=1

Reply via email to