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
 [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: Tue May 21 07:01:31 2024 UTC