|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #54657 Function parameters can no longer be named after superglobal variables
Submitted: 2011-05-04 14:04 UTC Modified: 2011-09-07 15:28 UTC
From: Assigned: cataphract (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: trunk-SVN-2011-05-04 (SVN) OS: Any
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:
17 + 14 = ?
Subscribe to this entry?

 [2011-05-04 14:04 UTC]
There is a backwards incompatible change in trunk in that function can no longer have parameters with a name equal to the one of some superglobal.

This should either be fixed with the previous behavior (the parameter shadows the superglobal) or documented in UPGRADING.

Test script:
$ php -d error_reporting=-1
function a($GLOBALS) {
        $GLOBALS['h'] = 8;
$g = null;

Expected result:
On 5.3:

Notice: Undefined variable: h in - on line 7

Actual result:
On trunk:

Fatal error: Cannot re-assign auto-global variable GLOBALS in - on line 2


Peimbert (last revision 2012-07-18 22:55 UTC by eduardopeimbert at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-07 15:27 UTC]
Automatic comment from SVN on behalf of cataphract
Log: - Fixed doc bug #54657: Function parameters can no longer be named after
  superglobal variables.
 [2011-09-07 15:28 UTC]
-Status: Open +Status: Closed -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cataphract
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Mar 27 06:03:38 2023 UTC