#31892 [Com]: PHP_SELF incorrect without cgi.fix_pathinfo, but turning on screws up PATH_INFO
| From: | mccammos at onid dot oregonstate dot edu | Date: | Thu, 26 Jul 2007 19:18:25 +0000 |
| Subject: | #31892 [Com]: PHP_SELF incorrect without cgi.fix_pathinfo, but turning on screws up PATH_INFO | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-115479@lists.php.net to get a copy of this message | ||
ID: 31892
Comment by: mccammos at onid dot oregonstate dot edu
Reported By: ceefour at gauldong dot net
Status: No Feedback
Bug Type: CGI related
Operating System: *
PHP Version: 5CVS, 4CVS (2005-02-11)
New Comment:
I just tried a July 26, 2007 snapshot of php5.2 and can report that the
bug still remains unfixed.
Previous Comments:
------------------------------------------------------------------------
[2007-07-18 01:00:00] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2007-07-10 11:34:53] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows (zip):
http://snaps.php.net/win32/php5.2-win32-latest.zip
For Windows (installer):
http://snaps.php.net/win32/php5.2-win32-installer-latest.msi
------------------------------------------------------------------------
[2006-05-29 18:47:35] php dot net at jon dot limedaley dot com
I assume this isn't going to be fixed? since it has been a year since
it was reported, and it is still in the "verified" state.
I figured php5 would be stable by now, but it appears that php_self is
broken with cgi.fix_pathinfo=0 and _SERVER["PATH_INFO"] is broken with
cgi.fix_pathinfo=1.
Is the official solution to use php4 instead?
------------------------------------------------------------------------
[2006-05-11 14:34:54] kk at keppler-it dot de
These patches are based on the code from Dave; the work fine within our
hosting environment.
http://www.keppler-it.de/tmp/patch-31892-4.4.2.diff
http://www.keppler-it.de/tmp/patch-31892-5.1.4.diff
Comments welcome. :-)
Here's the code in clear text (nearly identical for 4.x and 5.x):
--- php-4.4.2/sapi/cgi/cgi_main.c.orig 2006-01-01 14:47:01.000000000
+0100
+++ php-4.4.2/sapi/cgi/cgi_main.c 2006-05-11 16:23:51.000000000
+0200
@@ -871,11 +871,25 @@
} else {
#endif
/* pre 4.3 behaviour, shouldn't be used but
provides BC */
+ /*
if (env_path_info) {
SG(request_info).request_uri =
env_path_info;
} else {
SG(request_info).request_uri =
env_script_name;
}
+ */
+ /* <kk@keppler-it.de> PHP_SELF := SCRIPT_NAME +
PATH_INFO */
+ /* Patch based upon
http://spoonguard.org/dave/classes/cs345/bugfix/php-5.1.2-31892.diff
*/
+ SG(request_info).request_uri =
sapi_cgibin_getenv("SCRIPT_NAME", 0 TSRMLS_CC);
+ if (SG(request_info).request_uri &&
(env_path_info = sapi_cgibin_getenv("PATH_INFO", 0 TSRMLS_CC))) {
+ int request_uri_len =
strlen(SG(request_info).request_uri) + strlen(env_path_info) + 1;
+ char *request_uri = (char *)
emalloc(request_uri_len);
+ *request_uri = '\0';
+ strcat(request_uri,
SG(request_info).request_uri);
+ strcat(request_uri, env_path_info);
+ SG(request_info).request_uri =
request_uri;
+ }
+ /* </kk> */
#if !DISCARD_PATH
if (env_path_translated)
script_path_translated =
env_path_translated;
------------------------------------------------------------------------
[2006-05-09 02:11:21] lwalker at magi dot net dot au
I'm expreiencing the same issue on PHP 4.3 + 4.4 under Apache 1.3.33
and have had to switch back to mod_php for our hosting server.
Tried to access the patch to have a look at it, however it's not
loading.
Do you still have a copy of the patch, or are you able to post a
backported PHP 4.x version?
I do believe that SCRIPT_NAME + PHP_INFO is the expected behaviour.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31892
--
Edit this bug report at http://bugs.php.net/?id=31892&edit=1