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

Pull Requests

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: Sat Dec 21 17:01:58 2024 UTC