#18942 [Fbk->Opn]: $PHP_SELF is set to HTTP_SERVER_VARS[PATH_INFO] if available

From: Date: Fri, 16 Aug 2002 19:56:03 +0000
Subject: #18942 [Fbk->Opn]: $PHP_SELF is set to HTTP_SERVER_VARS[PATH_INFO] if available
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17049@lists.php.net to get a copy of this message
ID: 18942 User updated by: six@aegis-corp.org Reported By: six@aegis-corp.org -Status: Feedback +Status: Open Bug Type: Other web server Operating System: Debian PHP Version: 4.2.2 New Comment: There is a very fast way of testing, create a script called phpinfo.php with juste <?phpinfo()?> in it. Then call it like http://yourserver.com/phpinfo.php/this/is/a/test if the two images (zend and php logos) are broken, then $PHP_SELF is not set as it should be. again, this problem only happens with the CGI sapi Previous Comments: ------------------------------------------------------------------------ [2002-08-16 15:44:07] kalowsky@php.net Okay can we have a sample script just to ensure that we may or may not have fixed your issue? ------------------------------------------------------------------------ [2002-08-16 13:48:35] six@aegis-corp.org I checked and this bug revives #14307 which died some time ago unfixed. The code in question is in sapi/cgi/cgi_main.c : SG(request_info).request_uri = getenv("PATH_INFO"); if (!SG(request_info).request_uri) { SG(request_info).request_uri = getenv("SCRIPT_NAME"); } Should be more like : SG(request_info).request_uri = getenv("SCRIPT_NAME"); strcat(SG(request_info).request_uri, getenv("PATH_INFO")); ------------------------------------------------------------------------ [2002-08-16 13:39:03] six@aegis-corp.org With the CGI version of PHP, $PHP_SELF is always set to the value of HTTP_SERVER_VARS[PATH_INFO] if it is available. But the PATH_INFO server var does not at all designate the running script, which is by the SCRIPT_NAME var. This causes scripts using path_info (URLs like http://www.example.com/script/arg1/arg2/argX) to fail when using self refering links on a server using the CGI version on PHP. This bus does not exists with the apache module. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18942&edit=1

« previous php.bugs (#17049) next »