ID: 46395
Updated by: jani@php.net
Reported By: ebosman at gmail dot com
-Status: Bogus
+Status: Open
Bug Type: Directory function related
Operating System: Linux
PHP Version: 5.2.6
New Comment:
Sorry, misread the paths. :)
Previous Comments:
------------------------------------------------------------------------
[2008-10-26 18:49:22] jani@php.net
/var/www/bug/subdir/topl.inc does not exist. Of course you get an
error.
------------------------------------------------------------------------
[2008-10-26 18:15:19] ebosman at gmail dot com
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 this bug report at http://bugs.php.net/?id=46395&edit=1