ID: 26429 Updated by: [EMAIL PROTECTED] Reported By: skissane at ics dot mq dot edu dot au -Status: Open +Status: Assigned Bug Type: Documentation problem Operating System: Linux PHP Version: 4.3.4 -Assigned To: +Assigned To: kennyt New Comment:
I've written a note to tag under the element's description. Waiting for the manual to build now... (Is there a way to rebuild just one page? :) Previous Comments: ------------------------------------------------------------------------ [2003-12-15 14:58:18] [EMAIL PROTECTED] Rasmus: The documentation already states that you can't trust the $_SERVER values: "There is no guarantee that every webserver will provide any of these; servers may omit some, or provide others not listed here." However, skissane is correct. SCRIPT_FILENAME does return the relative path in the CLI version. The question is, should the code be fixed to make it absolute, or should the documentation have a note appended saying that it's not absolute in the CLI version? ------------------------------------------------------------------------ [2003-11-27 01:48:21] skissane at ics dot mq dot edu dot au rasmus wrote: "The docs should be modified to reflect the fact that all server variables except PHP_SELF, argc and argv are set by the web server and PHP has absolutely no control over their values" Not true -- As I said, I am using PHP-CLI. No webserver involved at all. Of course PHP has control over them all when running using the CLI sapi (excluding of course any brought in from the environment...) ------------------------------------------------------------------------ [2003-11-26 23:55:14] [EMAIL PROTECTED] The docs should be modified to reflect the fact that all server variables except PHP_SELF, argc and argv are set by the web server and PHP has absolutely no control over their values. While Apache sets them to one thing, another server may set them to another, and there may be differences between the server module version and the CGI interface to any of these web servers. ------------------------------------------------------------------------ [2003-11-26 23:50:28] skissane at ics dot mq dot edu dot au Description: ------------ According to the documentation: 'SCRIPT_FILENAME' The absolute pathname of the currently executing script. But, when I do 'echo $_SERVER["SCRIPT_FILENAME"]', using PHP-CLI, I get a pathname relative to the current directory. So either the docs are wrong, or the code is buggy (suggest that documented behaviour is more useful than actual behaviour, hence code should be changed.) (Despite what the form forced me to say above, I'm actually using 4.3.4RC1, not 4.3.4, but I hope it makes no difference. Apologies if it does.) Reproduce code: --------------- Make a directory called foo, under $HOME. Put this file as test.php in $HOME: <? echo $_SERVER["SCRIPT_FILENAME"] . "\n"; Now cd to $HOME Execute: php foo/test.php Expected result: ---------------- <path to your home directory>/foo/test.php Actual result: -------------- foo/test.php ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26429&edit=1