Bug #69625 [NEW]: http 200 response on nginx without SCRIPT_FILE
| From: | cfc4n at cnxct dot com | Date: | Tue, 12 May 2015 05:13:45 +0000 |
| Subject: | Bug #69625 [NEW]: http 200 response on nginx without SCRIPT_FILE | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-192625@lists.php.net to get a copy of this message | ||
From: cfc4n at cnxct dot com
Operating system: linux
PHP version: 5.6.9RC1
Package: FPM related
Bug Type: Bug
Bug description:http 200 response on nginx without SCRIPT_FILE
Description:
------------
In nginx config.conf file, configure info without fastcgi_param
SCRIPT_FILENAME, Any PHP files are returned blank response and http 200
status.
Because init_request_info function set default http response status 200,
request_method is null in fpm_main.c near line 985. And if
SCRIPT_FILENAME was not set in CGI protocol,
SG(request_info).request_method \ SG(sapi_headers).http_response_code
will not be reset .
The program will terminate at "if (!SG(request_info).request_method)"
near line 1838 in fpm_main.c ,
But http response status was 200 ,In fact it's a bug , The http response
will be 404 , There is comment in fpm_main.c near line 1846 "/* If
path_translated is NULL, terminate here with a 404 */" .
So, I think the code of SG(request_info).path_translated determine
should be placed in front of SG(request_info).request_method . Move line
1846-1855 into line 1835 .
more detail :
http://www.cnxct.com/php-return-empty-result-on-nginx-without-script_filename/
Expected result:
----------------
return http response 404 and write php_error log whiteout
SCRIPT_FILENAME
--
Edit bug report at https://bugs.php.net/bug.php?id=69625&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69625&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69625&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69625&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69625&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69625&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69625&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69625&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69625&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69625&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69625&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69625&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69625&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69625&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69625&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69625&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69625&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69625&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69625&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69625&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69625&r=mysqlcfg