#15793 [Dup->Csd]: inconsistent behaviour for __FILE__ constant
| From: | sniper@php.net | Date: | Mon, 30 Sep 2002 01:23:35 +0000 |
| Subject: | #15793 [Dup->Csd]: inconsistent behaviour for __FILE__ constant | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-20719@lists.php.net to get a copy of this message | ||
ID: 15793
Updated by: sniper@php.net
Reported By: jas@cs.yorku.ca
-Status: Duplicate
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Solaris 8
PHP Version: 4.1.2
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2002-07-25 06:15:43] niels@creatype.nl
This problem is a duplicate of:
Bug #13936 Magical Constant __FILE__ contains wrong information on
included files
http://bugs.php.net/bug.php?id=13936&edit=1
------------------------------------------------------------------------
[2002-02-28 17:00:24] pb@no_spam_please.pebe.net
I'm experiencing the exact same problem, and it's making horde/imp a
no-go. The new horde 2.0 and imp 3.0 is using __FILE__ everywhere in
the code, and due to this bug it just won't work without modifying a
lot of the code.
/pb
------------------------------------------------------------------------
[2002-02-28 16:00:08] jas@cs.yorku.ca
__FILE__ constant behaviour in PHP seems to have some problems that are
Solaris specific, and some problems that are just general.
Put the following in a file "test.php":
<?php
echo "file " . __FILE__;
?>
Try:
php test.php
The expected result is:
file <path to test.php>/test.php
The result on both Linux and Solaris PHP is:
file test.php
Now call the same php script VIA the web. The result will be the
expected "file <path to test.php>/test.php" on both Linux and Solaris.
If this isn't a bug, it seems like maybe an inconsistency in PHP
behaviour under different operating modes.
However, the problems continue.
Change the original test.php script above to:
<?php
echo "file " . __FILE__ . " ";
require_once './tmp/test1.php';
?>
And in tmp/test1.php put the following:
<?php
echo "file " . __FILE__;
?>
Access test.php VIA the web.
I expect to see:
file /cs/home/jas/www//test.php file /cs/home/jas/www/tmp/test1.php
On Linux that's what you'll see.
On Solaris, I see:
file /cs/home/jas/www/test.php file /tmp/test1.php
If I specify a full path to "tmp/test1.php" --
/cs/home/jas/www/tmp/test1.php, then the result is as expected.
What's going on with __FILE__? Am I misunderstanding its use?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15793&edit=1