From: Operating system: CentOS 2.6.18 PHP version: Irrelevant Package: Network related Bug Type: Feature/Change Request Bug description:headers_list should return in a key => value fashion
Description: ------------ The function headers_list() returns the headers in a numeric array fashion, although, headers are, AFAIK, always in a `Key: Value` fashion, therefore, associative array would be a better choice. More on this, header_remove() works by simply passing the key, therefore, in background, headers have their key representation, I suppose. I've made an example function that uses this function, for a header lookup, but ends up in "lots of lines" compared to what could be replaced with one: https://gist.github.com/1505803 P.S. This is my first file in PHP Bugs section, please guide me if I have given not enough information. Test script: --------------- header('Test-Header: A random result'); var_dump(headers_list()); Expected result: ---------------- array(5) { ["X-Powered-By"]=> string(23) "PHP/5.3.3" ["Expires"]=> string(38) "Thu, 19 Nov 1981 08:52:00 GMT" ["Cache-Control"]=> string(77) "no-store, no-cache, must-revalidate, post-check=0, pre-check=0" ["Pragma"]=> string(16) "no-cache" ["Test-Header"]=> string(28) "A random result" } Actual result: -------------- array(5) { [0]=> string(23) "X-Powered-By: PHP/5.3.3" [1]=> string(38) "Expires: Thu, 19 Nov 1981 08:52:00 GMT" [2]=> string(77) "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0" [3]=> string(16) "Pragma: no-cache" [4]=> string(28) "Test-Header: A random result" } -- Edit bug report at https://bugs.php.net/bug.php?id=60584&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=60584&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=60584&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=60584&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=60584&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=60584&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=60584&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=60584&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=60584&r=needscript Try newer version: https://bugs.php.net/fix.php?id=60584&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=60584&r=support Expected behavior: https://bugs.php.net/fix.php?id=60584&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=60584&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=60584&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=60584&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=60584&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=60584&r=dst IIS Stability: https://bugs.php.net/fix.php?id=60584&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=60584&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=60584&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=60584&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=60584&r=mysqlcfg