From:             [EMAIL PROTECTED]
Operating system: Solaris 8
PHP version:      4.1.2
PHP Bug Type:     Scripting Engine problem
Bug description:  inconsistent behaviour for __FILE__ constant

__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 bug report at http://bugs.php.net/?id=15793&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15793&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15793&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15793&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15793&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15793&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15793&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15793&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15793&r=submittedtwice

Reply via email to