Bug #76954 [Fbk->Opn]: Function apache_response_headers removes last character from header name
| From: | kalle@php.net | Date: | Thu, 04 Oct 2018 12:25:00 +0000 |
| Subject: | Bug #76954 [Fbk->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-217404@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
Updated by: kalle@php.net
Reported by: sasa dot todorovic101 at gmail dot com
Summary: Function apache_response_headers removes last
character from header name
-Status: Feedback
+Status: Open
Type: Bug
Package: CGI/CLI related
Operating System: Linux
PHP Version: 7.*
Block user comment: N
Private report: N
New Comment:
Ah my mistake, I just noticed the CGI SAPI (I was first under the impression that it was using the
apache2handler SAPI)
Previous Comments:
------------------------------------------------------------------------
[2018-10-04 12:23:28] kalle@php.net
Can you confirm if this also happens for the apache_request_headers() function?
------------------------------------------------------------------------
[2018-10-04 05:10:01] sasa dot todorovic101 at gmail dot com
It's related to all PHP 7 versions.
------------------------------------------------------------------------
[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