#23233 [NEW]: require() Fails With Absolute File Path in 4.3.1+

From: Date: Wed, 16 Apr 2003 04:25:33 +0000
Subject: #23233 [NEW]: require() Fails With Absolute File Path in 4.3.1+
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37734@lists.php.net to get a copy of this message
From: mdoocy at mac dot com Operating system: Windows NT 4.0 SP6 PHP version: 4.3.1 PHP Bug Type: Scripting Engine problem Bug description: require() Fails With Absolute File Path in 4.3.1+ After attempting to upgrade from 4.2.3 to 4.3.1, all require() statements suddenly failed. The following scripts were used to test require()'s functionality, and it was determined that the problem appears to be with the use of absolute file paths: ------ BEGIN /test.php ------ <html> <head> <title>PHP require() Test</title> </head> <body> <? $test_paths = array ( "./test1.inc.php", # works "./test/test2.inc.php", # works "/test1.inc.php", # works in 4.2.3, fails in 4.3.1+ "/test/test2.inc.php" # works in 4.2.3, fails in 4.3.1+ ); ?> <pre> PHP Version: <?= phpversion(); ?> <? foreach ($test_paths as $path) { echo "Requiring '$path': "; require($path); echo "\n"; } ?> </pre> </body> ------ END /test.php ------ ------ BEGIN /test1.inc.php ----- <?= " ...ok." ?> ------ END /test1.inc.php ------ ------ BEGIN /test/test2.inc.php ------ <?= " ...ok." ?> ------ END /test/test2.inc.php ------ Output of <http://server.tld/test.php> using PHP 4.2.3 from <http://www.php.net/get/php-4.2.3-Win32.zip/from/this/mirror>: ------ BEGIN 4.2.3 output ------ PHP Version: 4.2.3 Requiring './test1.inc.php': ...ok. Requiring './test/test2.inc.php': ...ok. Requiring '/test1.inc.php': ...ok. Requiring '/test/test2.inc.php': ...ok. ------ END 4.2.3 output ------ Output of <http://server.tld/test.php> using PHP 4.3.1 from <http://www.php.net/get/php-4.3.1-installer.exe/from/this/mirror>: ------ BEGIN 4.3.1 output ------ PHP Version: 4.3.1 Requiring './test1.inc.php': ...ok. Requiring './test/test2.inc.php': ...ok. Requiring '/test1.inc.php': Warning: main(/test1.inc.php) [function.main]: failed to create stream: No such file or directory in C:\InetPub\test.php on line 22 Fatal error: main() [function.main]: Failed opening required '/test1.inc.php' (include_path='C:\InetPub;c:\php\includes') in C:\InetPub\test.php on line 22 ------ END 4.3.1 output ------ Output of <http://server.tld/test.php> using PHP 4.3.2 from <http://snaps.php.net/win32/php4-win32-STABLE-200304160030.zip>: ------ BEGIN 4.3.2-RC output ------ PHP Version: 4.3.2-RC Requiring './test1.inc.php': ...ok. Requiring './test/test2.inc.php': ...ok. Requiring '/test1.inc.php': Warning: main(/test1.inc.php): failed to open stream: No such file or directory in C:\InetPub\test.php on line 22 Fatal error: main(): Failed opening required '/test1.inc.php' (include_path='C:\InetPub;c:\php\includes') in C:\InetPub\test.php on line 22 ------ END 4.3.2-RC output ------ [Note the slight difference between the outputs of 4.3.1 and 4.3.2-RC: the inclusion/exclusion of "[function.main]" after any mention of main() in a warning or error. Minor difference, but included for detail.] Execution of the installation programs (or manual binary/dll copy, in the case of 4.3.2-RC) are the only changes between tests: no change in include_path, php.ini, or any other manual configuration were performed. Tests were not performed using any versions of PHP between 4.2.3 and 4.3.1. -- Edit bug report at http://bugs.php.net/?id=23233&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23233&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23233&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23233&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23233&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23233&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23233&r=support Expected behavior: http://bugs.php.net/fix.php?id=23233&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23233&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23233&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23233&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23233&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23233&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23233&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23233&r=gnused

« previous php.bugs (#37734) next »