#26429 [Asn]: Documentation for $_SERVER["SCRIPT_FILENAME"] incorrect
| From: | derick@php.net | Date: | Thu, 01 Jan 2004 22:46:03 +0000 |
| Subject: | #26429 [Asn]: Documentation for $_SERVER["SCRIPT_FILENAME"] incorrect | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969357821@lists.php.net to get a copy of this message | ||
ID: 26429
Updated by: derick@php.net
Reported By: skissane at ics dot mq dot edu dot au
Status: Assigned
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 4.3.4
Assigned To: kennyt
New Comment:
Is it fixed in CVS or not? If it is -> Close the bug. And no you can't
build one page in the manual (nor do we want to do that as it's too
much work for every little change)
Previous Comments:
------------------------------------------------------------------------
[2004-01-01 17:39:07] kennyt@php.net
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? :)
------------------------------------------------------------------------
[2003-12-15 14:58:18] dave@php.net
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] rasmus@php.net
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