#34514 [NEW]: __FILE__ gives relative path if not in web root

From: Date: Thu, 15 Sep 2005 14:58:19 +0000
Subject: #34514 [NEW]: __FILE__ gives relative path if not in web root
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85102@lists.php.net to get a copy of this message
From: madison at westga dot edu Operating system: Solaris 8 PHP version: 4.4.0 PHP Bug Type: Scripting Engine problem Bug description: __FILE__ gives relative path if not in web root Description: ------------ This bug: http://bugs.php.net/bug.php?id=13936 appears never to have been completely resolved. Using the test code from the above bug... If the code resides somewhere in the DocumentRoot then it works as expected. But, if it resides in a users public_html directory or inside an aliased directory, it doesn't give the correct path. I get the same issue with the current CVS version of PHP5 and apache 2. Reproduce code: --------------- <?php echo "original file is: " . __FILE__ . "<br>"; include("test2.php"); ?> contents of test2.php: <?php echo "included file is: " . __FILE__ . "<br>"; $boo = "another try: " . __FILE__; echo $boo; ?> Expected result: ---------------- original file is: /home/madison/public_html/test.php included file is: /home/madison/public_html/test2.php another try: /home/madison/public_html/test2.php Actual result: -------------- original file is: /home/madison/public_html/test.php included file is: ./test2.php another try: ./test2.php -- Edit bug report at http://bugs.php.net/?id=34514&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34514&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34514&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34514&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34514&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34514&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34514&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34514&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34514&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34514&r=support Expected behavior: http://bugs.php.net/fix.php?id=34514&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34514&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34514&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34514&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34514&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34514&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34514&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34514&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34514&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34514&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34514&r=mysqlcfg

« previous php.bugs (#85102) next »