|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71274 func_get_args() behaviour change in PHP 7
Submitted: 2016-01-04 13:58 UTC Modified: 2016-01-06 19:08 UTC
From: Assigned: tpunt (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 7.0.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
5 + 30 = ?
Subscribe to this entry?

 [2016-01-04 13:58 UTC]
func_get_args() (and probably the related functions) are context sensitive in PHP 7.0 while it was not the case in PHP 5.x.

If you change the content of one of your arguments and then call func_get_args(), the change you made is reflected in the results you get, even if those were scalars.

See the results at:

Might be a doc issue if we consider that this behaviour is "normal" but it doesn't look documented and as per issue #30207, we previously emphasized that "func_get_args() returns the arguments *passed* to the function".

Test script:

function issueWithArgs($x) {
    $x = 33;
    return func_get_args();


Expected result:
array(1) {

Actual result:
array(1) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-04 19:38 UTC]
-Status: Open +Status: Duplicate -Package: PHP Language Specification +Package: Scripting Engine problem
 [2016-01-04 19:38 UTC]
The changes are intentional and the docs have already been updated (modified example and there's a note at the bottom). See also bug #71113.
 [2016-01-05 08:17 UTC]
Is the content of visible somewhere on ?

I digged and filed this bug because I couldn't find anything, did I miss something?
 [2016-01-05 09:02 UTC]
-Status: Duplicate +Status: Re-Opened -Type: Bug +Type: Documentation Problem
 [2016-01-05 09:02 UTC]
The migration docs are basically the online version of the UPGRADING guides. But I don't see any mention of func_get_args() in them either.
 [2016-01-06 18:47 UTC]
Automatic comment from SVN on behalf of tpunt
Log: Resolve doc bug #71274
 [2016-01-06 19:08 UTC]
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: tpunt
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 03:01:24 2020 UTC