|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-05-06 18:02 UTC] oskar-phpbug at eyb dot de
Description: ------------ It seems a never fixed problem with __FILE__ It looks like this description: http://bugs.php.net/bug.php?id=13936 After I updatetd because this bug from PHP 4.3.11 to 5.0.4, unfortunately, there is the same problem. I would be very grateful if this can be fixed now. Reproduce code: --------------- In install/steps/SystemChecksStep.class of the Gallery2 - Distribution there is the following code of interest: function CheckFileDirective() { if (strstr(__FILE__, 'install/steps/SystemChecksStep.class') || strstr(__FILE__, '\\install\\steps\\SystemChecksStep.class')) { return true; } else { return false; } } Expected result: ---------------- __FILE__ should return the full path, that is the absolute path, of the file where it's called in. __FILE__ returning a relative path is a known php problem and should have been fixed by now. it seems that PHP couldn't fix it for all system, i.e. obviously it doesn't work on your freebsd machine. Actual result: -------------- If I write above the if (...) die('__FILE__ = ' . __FILE__); then in the browser appears __FILE__ = ./steps/SystemChecksStep.class PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 23 12:00:01 2025 UTC |
In one vhost it works the following test, in another it doesn't. create in /home/whatever/www/test.php and in /home/whatever/www/sub1/testsub1.php and in /home/whatever/www/sub1/sub2/testsub2.php --- test.php <?php print __FILE__; print "<br>"; require("./sub1/testsub1.php"); ?> --- testsub1.php <?php print __FILE__; print "<br>"; require("./sub1/sub2/testsub2.php"); ?> --- testsub2.php <?php print __FILE__; ?> Result in vhost1 ------------------- /home/whatever/www/test.php /home/whatever/www/sub1/testsub1.php /home/whatever/www/sub1/sub2/testsub2.php Result in vhost2 ------------------- /home/whatever/www2/test.php ./sub1/testsub1.php ./sub1/sub2/testsub2.php I can't find no difference between the vhosts, in which its OK and the "disfunctional". In the diffs of both phpinfo() there are only vars like Hostname:Port, DOCUMENT_ROOT, HTTP_POST, SERVER_ADMIN, SERVER_NAME, UNIQUE_ID etc differential. But there must exist one?! httpd is Apache 1.3.33 This one is OK: <VirtualHost *:80> ServerAdmin www@... DocumentRoot /.../htdocs ServerName ... ServerAlias www.... ErrorLog /.../error_log CustomLog /.../access_log combined <Directory /.../htdocs> AllowOverride Options FileInfo </Directory> </VirtualHost> This one not: <VirtualHost *:80> ServerAdmin www@... DocumentRoot /.../htdocs ServerName ... ServerAlias www.... ErrorLog /.../www2/error_log CustomLog /.../www2/access_log combined <Directory /.../htdocs> AllowOverride Options FileInfo </Directory> </VirtualHost> The filesystem of these vhosts is the same. In the first vhost I can of course install gallery2 without any problems...