Bug #54657 [NEW]: Function parameters can no longer be named after superglobal variables
| From: | cataphract@php.net | Date: | Wed, 04 May 2011 12:04:52 +0000 |
| Subject: | Bug #54657 [NEW]: Function parameters can no longer be named after superglobal variables | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160534@lists.php.net to get a copy of this message | ||
From: cataphract
Operating system: Any
PHP version: trunk-SVN-2011-05-04 (SVN)
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Function parameters can no longer be named after superglobal variables
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
--
Edit bug report at http://bugs.php.net/bug.php?id=54657&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54657&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54657&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54657&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54657&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54657&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54657&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54657&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54657&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54657&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54657&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54657&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54657&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54657&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54657&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54657&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54657&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54657&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54657&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54657&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54657&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54657&r=mysqlcfg