From: [EMAIL PROTECTED] Operating system: any PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: a problem in a sample
Description: ------------ http://www.php.net/manual/en/language.functions.php#AEN5142 a problem exists in the sample of a manual. this problem is not checking exist of bar. The right example: <?php function foo() { if ( !function_exists( "bar")) <== add { <== add function bar() { echo "I don't exist until foo() is called.\n"; } } <== add } ?> Reproduce code: --------------- <?php error_reporting(E_ALL); ini_set( "display_errors", "on"); function foo() { function bar() { echo "I don't exist until foo() is called.\n"; } } foo(); bar(); foo(); // Fatal error: Cannot redeclare bar() ?> Expected result: ---------------- Fatal error: Cannot redeclare bar() (previously declared in /path/for/script/foo.php:10) in /path/for/script/foo.php on line 8 Actual result: -------------- I don't exist until foo() is called. I don't exist until foo() is called. -- Edit bug report at http://bugs.php.net/?id=33293&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33293&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33293&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33293&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33293&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33293&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33293&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33293&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33293&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33293&r=support Expected behavior: http://bugs.php.net/fix.php?id=33293&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33293&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33293&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33293&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33293&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33293&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33293&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33293&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33293&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33293&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33293&r=mysqlcfg