|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-07-17 21:44 UTC] yohgaki@php.net
[2014-07-18 05:43 UTC] herve at moulticast dot net
[2014-07-21 01:10 UTC] yohgaki@php.net
-Status: Open
+Status: Verified
[2014-07-21 01:10 UTC] yohgaki@php.net
[2014-07-21 07:37 UTC] arjen at react dot com
[2017-01-15 07:21 UTC] krakjoe@php.net
-Status: Verified
+Status: Feedback
[2017-01-15 07:21 UTC] krakjoe@php.net
[2017-01-29 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 13:00:01 2025 UTC |
Description: ------------ Running Debian with kernel 3.14-1-amd64 Webserver: NginX 1.6.0 PHP: 5.6.0RC2 FPM The getallheaders() method does not build a clean array. When trying to access some values via $arr['key'] it doesn't work because there is a non printable character '0' that is added at the end of the key. Test script: --------------- <?php // Working example foreach($_SERVER as $key => $value) { print('Key: '. $key . ' => ' . $value . "\n"); $key_arr = str_split($key); foreach($key_arr as $char) { print($char . ' => ' . ord($char) .' '); } print "\n"; } // Buggy example using getallheaders $hdrs = getallheaders(); foreach($hdrs as $key => $value) { print('Key: '. $key . ' => ' . $value . "\n"); $key_arr = str_split($key); foreach($key_arr as $char) { print($char . ' => ' . ord($char) .' '); } print "\n"; } ?> Expected result: ---------------- Key for header 'User-Agent' should be (in ASCII): 85 115 101 114 45 65 103 101 110 116 Actual result: -------------- Key for header 'User-Agent' is (in ASCII): 85 115 101 114 45 65 103 101 110 116 0