From: dragoonis Operating system: PHP version: 5.3.3 Package: *Web Server problem Bug Type: Bug Bug description:Headers_List not returning HTTP Status Code
Description: ------------ Ok so i've found the reason why this doesn't work but i'd like feedback on the appropriate area to change as this looks like it was intentionally developed this way. headers_list() gets passed SG(sapi_headers).headers and prints them. This works however when you do header() -> sapi_header_op() and you set a response code such as 'HTTP/1.0 404 Not Found'. It does not put this header into SG(sapi_headers).headers but it puts it into SG(sapi_headers).http_response_code instead. This looks to be intentional as there are special functions for updating the response code such as sapi_update_response_code() So the end question is, should I modify sapi_header_op() to also include the response code in SG(sapi_headers).headers or should I modify headers_list() to receive SG(sapi_headers).headers and SG(sapi_headers).http_response_code. I could also make a new function which only returns SG(sapi_headers).http_response_code but i think that's a waste of time and could update headers_list() or whatnot. FYI: I tested apache_response_headers() and got no http response code in their either. Test script: --------------- <?php header("Content-type: text/plain"); header('HTTP/1.0 404 Not Found'); var_dump(headers_list()); exit; Expected result: ---------------- array(3) { [0]=> string(34) "X-Powered-By: PHP/5.3.2-1ubuntu4.2" [1]=> string(30) "Content-type: text/plain" [2]=> string(22) "HTTP/1.0 404 Not Found" } Actual result: -------------- array(2) { [0]=> string(34) "X-Powered-By: PHP/5.3.2-1ubuntu4.2" [1]=> string(30) "Content-type: text/plain" } -- Edit bug report at http://bugs.php.net/bug.php?id=52555&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52555&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52555&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52555&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52555&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52555&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52555&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52555&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52555&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52555&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52555&r=support Expected behavior: http://bugs.php.net/fix.php?id=52555&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52555&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52555&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52555&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52555&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=52555&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52555&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52555&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52555&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52555&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52555&r=mysqlcfg