From: ebosman at gmail dot com Operating system: Linux PHP version: 5.2.6 PHP Bug Type: Directory function related Bug description: Inconsistent behaviour of require_once
Description: ------------ In the code pasted below: - top.php fails on subdir/sub.inc including "../top1.inc" - subdir/sub.php doesn't. Either every include should be relative to the original php file (which would be braindead, but consistent.) In that case both php files should fail (for subdir/sub.php the include of top2.inc by top1.inc should fail.) Or (and this is what I expected) include files should be relative to the file that is including. In which case both should succeed. Probably the same bug as http://bugs.php.net/bug.php?id=38302 , which is labeled bogus, so I had to create a new one. Reproduce code: --------------- mkdir -p bug/subdir echo '<?php require_once "../top1.inc" ?>' > bug/subdir/sub.inc echo '<?php require_once "sub.inc" ?>' > bug/subdir/sub.php echo '<?php require_once "subdir/sub.inc" ?>' > bug/top.php echo '<?php require_once "top2.inc" ?>' > bug/top1.inc touch bug/top2.inc Expected result: ---------------- Neither top.php nor subdir/sub.php should generate errors (or both should.) Actual result: -------------- Warning: require_once(../top1.inc) [function.require-once]: failed to open stream: No such file or directory in /var/www/bug/subdir/sub.inc on line 1 Fatal error: require_once() [function.require]: Failed opening required '../top1.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/bug/subdir/sub.inc on line 1 -- Edit bug report at http://bugs.php.net/?id=46395&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46395&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46395&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46395&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46395&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46395&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46395&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46395&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46395&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46395&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46395&r=support Expected behavior: http://bugs.php.net/fix.php?id=46395&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46395&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46395&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46395&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46395&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46395&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46395&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46395&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46395&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46395&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46395&r=mysqlcfg