php.net |  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: cataphract@php.net 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
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: cataphract@php.net
New email:
PHP Version: OS:

 

 [2011-05-04 14:04 UTC] cataphract@php.net
Description:
------------
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
<?php
function a($GLOBALS) {
        $GLOBALS['h'] = 8;
}
$g = null;
a($g);
var_dump($h);

Expected result:
----------------
On 5.3:

Notice: Undefined variable: h in - on line 7
NULL


Actual result:
--------------
On trunk:

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

Patches

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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-07 15:27 UTC] cataphract@php.net
Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=316364
Log: - Fixed doc bug #54657: Function parameters can no longer be named after
  superglobal variables.
 [2011-09-07 15:28 UTC] cataphract@php.net
-Status: Open +Status: Closed -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: cataphract
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 28 18:01:28 2024 UTC