php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69821 Re-assigning argument affects func_get_args()
Submitted: 2015-06-13 19:23 UTC Modified: 2015-06-13 19:34 UTC
From: lbarnaud@php.net Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.0.0alpha1 OS:
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: lbarnaud@php.net
New email:
PHP Version: OS:

 

 [2015-06-13 19:23 UTC] lbarnaud@php.net
Description:
------------
When re-assigning an argument in a function, func_get_args() doesn't return the original argument values anymore.

I found this while using Doctrine 2.3: https://github.com/doctrine/doctrine2/blob/b5e19dca182ee4c21dd26d14b2d707cd4ad4e95e/lib/Doctrine/ORM/QueryBuilder.php#L849 .

Test script:
---------------
<?php

function test($a) {
    $a = "overridden";
    var_dump(func_get_args());
}

test("original");

Expected result:
----------------
array(1) {
  [0]=>
  string(8) "original"
}

Actual result:
--------------
array(1) {
  [0]=>
  string(10) "overridden"
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-13 19:34 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Dec 02 13:05:53 2022 UTC