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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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