Bug #12444: require_once doesn't support relative paths completely
| From: | willwong at samurai dot com | Date: | Sat, 28 Jul 2001 05:05:09 +0000 |
| Subject: | Bug #12444: require_once doesn't support relative paths completely | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-61306@lists.php.net to get a copy of this message | ||
From: willwong@samurai.com
Operating system: FreeBSD
PHP version: 4.0.6
PHP Bug Type: Feature/Change Request
Bug description: require_once doesn't support relative paths completely
I was unable to alter the previous report because I had not entered a
password when I reported the bug...
It appears to work in simple cases:
ie when:
/php/test.php
/common.php
in test.php
<?
require_once('../common.php');
display_test();
?>
in common.php
<?
function display_test()
{
echo 'test';
}
?>
But it fails in the following case:
/usr/home/willwong/public_html/common.php
/usr/home/willwong/public_html/php/common2.php
/usr/home/willwong/public_html/php/php2/test.php
in test.php
<?
require_once('../../common.php');
display_test();
?>
in common.php
<?
require_once('php/common2.php');
?>
in common2.php
<?
function display_test()
{
echo 'test';
}
?>
This fails with the error:
Fatal error: Failed opening required 'php/common2.php' (include_path='') in
/usr/home/willwong/public_html/common.php on line 2
--
Edit bug report at: http://bugs.php.net/?id=12444&edit=1