|  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
Status: Closed Package: Scripting Engine problem
PHP Version: trunk-SVN-2011-05-04 (SVN) OS: Any
Private report: No CVE-ID:
 [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-2015 The PHP Group
All rights reserved.
Last updated: Fri Nov 27 15:01:33 2015 UTC