ID: 47495 Updated by: theta...@php.net Reported By: leha at inkin dot ru -Status: Open +Status: Feedback Bug Type: iPlanet related Operating System: Linux 2.6.26 PHP Version: 5.2.8 New Comment:
Please try using this CVS snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ As headers_list was a addition to PHP 5, not all SAPIs were aware of this and can handle it correctly. The PHP SAPI layer has two possibilities, to handle the headers: - a callback that sets the header (NSAPI and other SAPIs use this, parse the header and set it in the webserver internal hashtable), SAPI will forget about the header after that. - the headers are sent, when the response is committed, SAPI collects all headers in a SAPI-internal list. The first solution had the problem, that the SAPIs manage the complete header addition and the PHP SAPI layer does not know anything about previously set headers (because the list of headers is not replicated). Calls to nsapi_response_headers (you should use this function, as apache_response_headers is only available in NSAPI for compatibility) retrieve the headers directly from the underlying webserver (you will also see headers, like "Connection" or other Keep-alive-headers, that were not set by PHP). In NSAPI (and other SAPIs) headers_list() does not return anything, because the PHP-internal header list is always empty (because headers are managed by webserver only). In PHP 5.3 a new SAPI callback that is also able to remove headers was implemented. This new SAPI-layer always caches the header list additionally to the webserver, so header_list will return the PHP-set headers here (but no lower-level headers by the webserver). This bug will not be fixed in 5.2, can you please try PHP 5.3 snapshot and report if it works correctly there? Previous Comments: ------------------------------------------------------------------------ [2009-02-24 15:06:17] leha at inkin dot ru The whole php.ini: [PHP] magic_quotes_gpc = off include_path = ".:/usr:/usr/share/php" upload_max_filesize = 10M ------------------------------------------------------------------------ [2009-02-24 15:02:15] leha at inkin dot ru Description: ------------ headers_list() returns an empty array. Though apache_response_headers() works fine. Using Sun Java System Web Server 7.0 Update 3 + PHP 5.2.8. The same problem is with older SJSWS 7.0 U1 + PHP 5.2.1. ./configure --with-nsapi=/opt/webserver7u3 --with-openssl=/usr --with- enable-dbase --enable-exif --enable-ftp --with-gd --with-ttf --with-t1lib=/usr --with- enable-mbstring --with-libmbfl --with-mcrypt --with-mhash --with-ming --with- with-libxml-dir --with-freetype-dir --with-xsl Reproduce code: --------------- <?php header('Content-Type: text/html'); var_dump(headers_list()); ?> Expected result: ---------------- array(4) { [0]=> string(23) "X-Powered-By: PHP/5.2.8" [1]=> string(23) "Content-type: text/html" } Actual result: -------------- array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47495&edit=1