From: danielc at analysisandsolutions dot com Operating system: PHP version: 5.3.0beta1 PHP Bug Type: Scripting Engine problem Bug description: $php_errormsg out of scope in functions
Description: ------------ The scope of $php_errormsg has changed in 5.3. It is no longer available inside functions. Perhaps this is intentional, perhaps not. If it is intentional, I encourage the decision be changed to improve compatibility between versions. If it won't be changed, we need to update the 5.3 upgrade guide at http://wiki.php.net/doc/scratchpad/upgrade/53. Reproduce code: --------------- if (!...@substr('no 2nd parameter')) { echo '$php_errormsg in global: ' . $php_errormsg . "\n"; } function foo() { if (!...@substr('no 2nd parameter')) { echo '$php_errormsg in function: ' . $php_errormsg . "\n"; echo '$GLOBALS[php_errormsg] in function: ' . $GLOBALS['php_errormsg'] . "\n"; } } foo(); Expected result: ---------------- $php_errormsg in global: substr() expects at least 2 parameters, 1 given $php_errormsg in function: substr() expects at least 2 parameters, 1 given $GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given Actual result: -------------- $php_errormsg in global: substr() expects at least 2 parameters, 1 given Notice: Undefined variable: php_errormsg in D:\webroot\ideasphp\Atest.html on line 10 $php_errormsg in function: $GLOBALS[php_errormsg] in function: substr() expects at least 2 parameters, 1 given -- Edit bug report at http://bugs.php.net/?id=47320&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47320&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47320&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47320&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47320&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47320&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47320&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47320&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47320&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47320&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47320&r=support Expected behavior: http://bugs.php.net/fix.php?id=47320&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47320&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47320&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47320&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47320&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47320&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47320&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47320&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47320&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47320&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47320&r=mysqlcfg