From: ohland_e at epitech dot net
Operating system: Linux (archlinux)
PHP version: 5.5.14
Package: Built-in web server
Bug Type: Bug
Bug description:Unable to access to apache_request_headers() elements
Description:
------------
I cannot access to elements of an array returned by
apache_request_headers() with the PHP embedded web server (ie: php -S
localhost:8000) but I can see them when I var_dump() the array.
Test script:
---------------
<?php
header('Content-Type: text/plain');
$headers = apache_request_headers();
echo '$headers["Host"] = ';
var_dump($headers['Host']);
echo '$headers = ';
var_dump($headers);
?>
Expected result:
----------------
The following output is excepted:
$headers["Host"] = string(14) "localhost:8080"
$headers = array(8) {
["Host"]=>
string(14) "localhost:8080"
["Connection"]=>
string(10) "keep-alive"
["Cache-Control"]=>
string(9) "max-age=0"
["Accept"]=>
string(74)
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
["User-Agent"]=>
string(105) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
["DNT"]=>
string(1) "1"
["Accept-Encoding"]=>
string(17) "gzip,deflate,sdch"
["Accept-Language"]=>
string(35) "en-US,en;q=0.8,fr-FR;q=0.6,fr;q=0.4"
}
Actual result:
--------------
The "$headers['Host']" variable is not set and I got NULL. This happend
for every element of the array.
Here is the actual output:
$headers["Host"] = NULL
$headers = array(8) {
["Host"]=>
string(14) "localhost:8080"
["Connection"]=>
string(10) "keep-alive"
["Cache-Control"]=>
string(9) "max-age=0"
["Accept"]=>
string(74)
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
["User-Agent"]=>
string(105) "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36"
["DNT"]=>
string(1) "1"
["Accept-Encoding"]=>
string(17) "gzip,deflate,sdch"
["Accept-Language"]=>
string(35) "en-US,en;q=0.8,fr-FR;q=0.6,fr;q=0.4"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=67594&edit=1
--