From: rblanker at xs4all dot nl Operating system: Linux Fedora 4 PHP version: 5.1.4 PHP Bug Type: Scripting Engine problem Bug description: require_once does not include files with same name,but are in other locations
Description: ------------ require_once() (probably include_once() too, haven't tested) does not include files in 2 different directories when both files have the same filename (but are 2 different files in 2 different paths); require_once() stores what is given and skips any require_once() with the same input, not matter what the location is where require_once() was called. It should store/compare the complete path of the included file, not the input. The workaround is now by specifing the whole path; require_once($_SERVER["DOCUMENT_ROOT"] . "/toinclude.php"); Reproduce code: --------------- create 4 files; /index.php: <? print "this is /index.php\n"; require_once("toinclude.php"); require_once("bug/index.php"); ?> /toinclude.php: <? print "this is /toinclude.php\n"; ?> /bug/index.php; <? print "this is /bug/index.php\n"; require_once("toinclude.php"); ?> /bug/toinclude.php; <? print "this is /bug/toinclude.php\n"; ?> Now call '/index.php' Expected result: ---------------- this is /index.php this is /toinclude.php this is /bug/index.php this is /bug/toinclude.php Actual result: -------------- this is /index.php this is /toinclude.php this is /bug/index.php -- Edit bug report at http://bugs.php.net/?id=37847&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37847&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37847&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37847&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37847&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37847&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37847&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37847&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37847&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37847&r=support Expected behavior: http://bugs.php.net/fix.php?id=37847&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37847&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37847&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37847&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37847&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37847&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37847&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37847&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37847&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37847&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37847&r=mysqlcfg