php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69155 reference seems incorrect when parameter is passed by expression
Submitted: 2015-03-02 09:47 UTC Modified: 2015-03-02 16:03 UTC
From: leejqy at 163 dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.4.38 OS: linux/windows
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: leejqy at 163 dot com
New email:
PHP Version: OS:

 

 [2015-03-02 09:47 UTC] leejqy at 163 dot com
Description:
------------
When a parameter(declared as reference) is passed by mixing an expression & assignment, the paramter actually passed seems to be the expression, not the variable itself.

PHP version tested: 5.4.37 & 5.5.18.

Test script:
---------------
function test (&$a)
{
    $a = 10;
}
test ($a = 20);
echo $a;


Expected result:
----------------
10

Actual result:
--------------
20

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-02 16:03 UTC] reeze@php.net
-Status: Open +Status: Not a bug
 [2015-03-02 16:03 UTC] reeze@php.net
@see http://3v4l.org/CaKKR

There is a strict warning complain about it.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC