Edit report at https://bugs.php.net/bug.php?id=20226&edit=1
ID: 20226 Updated by: [email protected] Reported by: tom at tomclegg dot net Summary: can't do "foo.php/path.inf" via cgi (with patch) -Status: Feedback +Status: No Feedback Type: Feature/Change Request Package: CGI/CLI related Operating System: Unix PHP Version: 4.2.3 New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. Previous Comments: ------------------------------------------------------------------------ [2010-12-29 17:50:54] [email protected] Please try using this snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2002-11-03 05:36:42] tom at tomclegg dot net I use php as a cgi usuing Apache's "Action" directive. If I put a script in /u/joe/pub/example.php and visit http://joe/example.php/foo then Apache puts /example.php/foo in PATH_INFO, and PHP tries to open /u/joe/pub/example.php/foo. (Internal server error; premature end of script headers) This patch checks /u, /u/joe, /u/joe/pub, etc.; if one of them is a regular file (in this case /u/joe/pub/example.php) then that file is used as the script filename. Now the script runs, with the entire PATH_INFO passed to it. (It's up to the script to figure out which part to ignore.) --- main/fopen_wrappers.c.orig Fri Aug 23 01:00:49 2002 +++ main/fopen_wrappers.c Sun Nov 3 02:54:26 2002 @@ -388,6 +388,23 @@ SG(request_info).path_translated = NULL; return FAILURE; } + + /* check for /home/joe/public_html/example.php/pathinfo */ + if (1) { + char *s; + for (s=filename+1; *s; s++) { + if (*s == PHP_DIR_SEPARATOR && *(s-1) != PHP_DIR_SEPARATOR) { + *s = 0; + if (0 == stat (filename, &st)) { + if (S_ISREG(st.st_mode)) { + break; + } + } + *s = PHP_DIR_SEPARATOR; + } + } + } + fp = VCWD_FOPEN(filename, "rb"); /* refuse to open anything that is not a regular file */ ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=20226&edit=1
