Bug #76954 [Opn]: Function apache_response_headers removes last character from header name
| From: | sasa dot todorovic101 at gmail dot com | Date: | Thu, 04 Oct 2018 05:10:01 +0000 |
| Subject: | Bug #76954 [Opn]: Function apache_response_headers removes last character from header name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217398@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76954&edit=1
ID: 76954
User updated by: sasa dot todorovic101 at gmail dot com
Reported by: sasa dot todorovic101 at gmail dot com
Summary: Function apache_response_headers removes last
character from header name
Status: Open
Type: Bug
Package: CGI/CLI related
Operating System: Linux
-PHP Version: 7.2.10
+PHP Version: 7.*
Block user comment: N
Private report: N
New Comment:
It's related to all PHP 7 versions.
Previous Comments:
------------------------------------------------------------------------
[2018-10-01 06:36:31] sasa dot todorovic101 at gmail dot com
Added PR https://github.com/php/php-src/pull/3566 (I use
comment because 'Add a Pull Request' doesn't work).
------------------------------------------------------------------------
[2018-10-01 04:53:07] sasa dot todorovic101 at gmail dot com
Description:
------------
This function works correctly in PHP 5.x, but in PHP 7.x(sapi CGI) last characters from
header's names are removed.
More details - https://github.com/Automattic/wp-super-cache/issues/539
Test script:
---------------
<?php
header( 'Link: <http://www.example.com/wp-json>; rel="https://api.w.org/"' );
header( 'X-Robots-Tag: noindex,nofollow,noarchive' );
echo '<html><body><pre>';
foreach ( apache_response_headers() as $hdr_key => $hdr_val ) {
echo $hdr_key . ' => ' . htmlentities( $hdr_val ) . PHP_EOL;
}
echo '</pre></body></html>';
Expected result:
----------------
X-Powered-By => PHP/7.2.10
Link => <http://www.example.com/wp-json>;
rel="https://api.w.org/"
X-Robots-Tag => noindex,nofollow,noarchive
Content-type => text/html; charset=UTF-8
Actual result:
--------------
X-Powered-B => PHP/7.2.10
Lin => <http://www.example.com/wp-json>;
rel="https://api.w.org/"
X-Robots-Ta => noindex,nofollow,noarchive
Content-typ => text/html; charset=UTF-8
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76954&edit=1