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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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: Tue Jul 15 01:01:35 2025 UTC