Bug #12203: Inconsistent __FILE__ contents when using require/require_once
| From: | adam at iewebs dot com | Date: | Tue, 17 Jul 2001 12:20:14 +0000 |
| Subject: | Bug #12203: Inconsistent __FILE__ contents when using require/require_once | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-60150@lists.php.net to get a copy of this message | ||
From: adam@iewebs.com
Operating system: Red Hat 7.1
PHP version: 4.0.4pl1
PHP Bug Type: Filesystem function related
Bug description: Inconsistent __FILE__ contents when using require/require_once
Not sure if this is a bug or a feature, or what the correct result should
be, but...
Related to bug #6636, require_once() and include_once() used on a soft link
will result in the __FILE__ constant containing only the filename of the
link, whereas include() and require() will result in __FILE__ containing
the full path and filename of the linked file.
ln -s /path/to/file.php /path/to/link.php
CASE ONE:
require_once('/path/to/link.php');
// returns 'link.php'
echo __FILE__;
CASE TWO:
require('/path/to/link.php');
// returns '/path/to/file.php'
echo __FILE__;
--
Edit bug report at: http://bugs.php.net/?id=12203&edit=1