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
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC