From: php dot devel at homelinkcs dot com Operating system: Mandrake Linux 10.0 PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Multiple incude()'s of file with func defs incorrectly documented for PHP 4
Description: ------------ The documentation page for the include() construct states that: "If there are functions defined in the included file, they can be used in the main file independent if they are before return() or after. If the file is included twice, PHP 5 issues fatal error because functions were already declared, while PHP 4 doesn't complain about it." However, PHP 4 _does_ "complain" (which it should) about it as demonstrated below. Therefore, I believe the second sentence in the quote above should read, "If the file is included twice, a fatal error is issued because functions were already declared." Reproduce code: --------------- a.php: <?php include("b.php"); include("b.php"); ?> b.php: <?php function foo() { echo "I've been included!\n"; } ?> Running a.php, PHP 4.3.4 dies with: Fatal error: Cannot redeclare foo() (previously declared in /tmp/b.php:3) in /tmp/b.php on line 2 -- Edit bug report at http://bugs.php.net/?id=30723&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30723&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30723&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30723&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30723&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30723&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30723&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30723&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30723&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30723&r=support Expected behavior: http://bugs.php.net/fix.php?id=30723&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30723&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30723&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30723&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30723&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30723&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30723&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30723&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30723&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30723&r=mysqlcfg