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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 08:01:33 2024 UTC