php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45603 error for reference
Submitted: 2008-07-23 12:02 UTC Modified: 2008-07-23 13:46 UTC
From: wojtek77 at o2 dot pl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.6 OS: Windows 2003 server
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: wojtek77 at o2 dot pl
New email:
PHP Version: OS:

 

 [2008-07-23 12:02 UTC] 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.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-23 13:46 UTC] 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..
 [2012-10-16 14:20 UTC] wojtek77 at o2 dot pl
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 16:01:34 2025 UTC