php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36051 Suspicous reference-argument behavour at func($m=null)
Submitted: 2006-01-17 15:42 UTC Modified: 2006-01-19 08:31 UTC
From: php at koterov dot ru Assigned: dmitry (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.2 OS: Windows XP
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: php at koterov dot ru
New email:
PHP Version: OS:

 

 [2006-01-17 15:42 UTC] php at koterov dot ru
Description:
------------
Seems assignment-and-passing by reference becomes broken in PHP 5.1.

PHP 4.x and 5.0 work as expected. See sample below.

Seems PHP assigns value to $x AFTER calling function f(), but NOT before it. Or - only copy of $x passed to f(), not $x itself (as in 4.0 & 5.0).

Reproduce code:
---------------
<?php
function f(&$m)
{
	$m = 123;
}
f($x=0);
var_dump($x);
?>

Expected result:
----------------
int(123)

Actual result:
--------------
int(0)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-17 15:43 UTC] derick@php.net
Dmitry, this is another one similar - I really think we should address this issue to the PHP 5.1.1 situation.
 [2006-01-19 08:31 UTC] dmitry@php.net
See comments: http://bugs.php.net/bug.php?id=35995
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 11:01:34 2025 UTC