Bug #15793 Updated: inconsistent behaviour for __FILE__ constant

From: Date: Thu, 25 Jul 2002 10:17:00 +0000
Subject: Bug #15793 Updated: inconsistent behaviour for __FILE__ constant
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15153@lists.php.net to get a copy of this message
ID: 15793 Updated by: derick@php.net Reported By: jas@cs.yorku.ca -Status: Open +Status: Duplicate Bug Type: Scripting Engine problem Operating System: Solaris 8 PHP Version: 4.1.2 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

« previous php.bugs (#15153) next »