|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29683 headers_list() func. return empty array
Submitted: 2004-08-14 23:58 UTC Modified: 2005-06-20 14:53 UTC
Avg. Score:4.3 ± 0.8
Reproduced:12 of 12 (100.0%)
Same Version:4 (33.3%)
Same OS:3 (25.0%)
From: ca533512 at tiscali dot cz Assigned:
Status: Closed Package: Apache related
PHP Version: 5.0.1 OS: Win2k SP4
Private report: No CVE-ID: None
 [2004-08-14 23:58 UTC] ca533512 at tiscali dot cz
If I try code from PHP docs of headers_list() function, browser print only empty array.

or this function is not available on win OS ?

Reproduce code:
/* setcookie() will add a response header on its own */
setcookie('foo', 'bar');
/* Define a custom response header
   This will be ignored by most clients */
header("X-Sample-Test: foo");
/* Specify plain text content in our response */
header('Content-type: text/plain');
/* What headers are going to be sent? */

Expected result:
array(4) {
  string(29) "X-Powered-By: PHP/5.0.0" // ... 5.0.1
  string(19) "Set-Cookie: foo=bar"
  string(18) "X-Sample-Test: foo"
  string(24) "Content-type: text/plain"

Actual result:
array(0) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-23 18:59 UTC]
What SAPI are you using? 
 [2004-08-23 19:59 UTC] ca533512 at tiscali dot cz
Apache 2.0.50

-- php: `original` for win32 from
 [2004-08-24 06:38 UTC]
This is also reproducible with Apache 1.3.x SAPI.
It happens because sapi_module.header_handler (particularly sapi_apache_header_handler() with Apache 1.3.x) returns 0 instead of SAPI_HEADER_ADD and headers just don't get to SG(sapi_headers).
 [2005-01-09 19:04 UTC] tiagojcb at hotmail dot com
Hi !

Server version: Apache/2.0.52
Server built:   Oct 20 2004 11:51:56

Loaded Modules 	core mod_access mod_auth mod_include mod_log_config mod_env mod_setenvif mod_ssl prefork http_core mod_mime mod_asis mod_negotiation mod_dir mod_imap mod_actions mod_so mod_php5

PHP 5.0.3 (cli) (built: Jan  9 2005 15:46:57)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies

If I run the example code from the CLI, it works. 
From apache it return an empty array.

It's running on a Slackware Linux and php was built with './configure' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-gd' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-zlib' '--enable-memory-limit' '--with-pgsql=/usr/local/pgsql' '--prefix=/usr/local/php' '--without-mysql'

Thanks for any help.
 [2005-02-15 11:43 UTC] rd dot contact at free dot fr
Same bug on win xp and apache 2.52 
Same code from PHP doc tested with today's (15 Fev 2005)
 [2005-03-06 20:58 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-05-20 22:20 UTC] alisencer at gmail dot com
I have the same problem on Ubuntu 5.04 Hoary.

Server Version: Apache/2.0.53
Server built: May 6 2005

headers_list() returns an empty array.
 [2005-05-20 23:21 UTC]
Still valid for 5.0.5-dev and 5.1-dev.
 [2005-06-20 14:53 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

Fixed for 5.0 and 5.1.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 01 15:01:30 2024 UTC