Bug #45603 [Com]: error for reference
Edit report at https://bugs.php.net/bug.php?id=45603&edit=1
ID: 45603
Comment by: wojtek77 at o2 dot pl
Reported by: wojtek77 at o2 dot pl
Summary: error for reference
Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Windows 2003 server
PHP Version: 5.2.6
Block user comment: N
Private report: N
New Comment:
Hello,
This problem lies in the fact that the variable $x = array(0 => 1) after passing
through the function x() changes its value on the array(0 => 0), if prior to
entering the function do:
$aaa = &$x[0];
Regards.
Previous Comments:
------------------------------------------------------------------------
[2008-07-23 13:46:18] jani@php.net
Please submit a new report. This is totally useless/confusing.
You should fill all the textboxes in the "report a bug" page..
------------------------------------------------------------------------
[2008-07-23 12:02:03] wojtek77 at o2 dot pl
Description:
------------
Is OK:
function x($x)
{
$x[0] = 0;
}
$x = array(1);
print_r($x);
//$aaa = & $x[0];
x($x);
print_r($x);
//Array ( [0] => 1 ) Array ( [0] => 1 )
Is not OK:
Is OK:
function x($x)
{
$x[0] = 0;
}
$x = array(1);
print_r($x);
$aaa = & $x[0];
x($x);
print_r($x);
//Array ( [0] => 1 ) Array ( [0] => 0 )
//Variable $x underwent the change.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=45603&edit=1
Thread (3 messages)