php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61605 header_remove() does not remove all headers
Submitted: 2012-04-02 23:20 UTC Modified: 2012-04-04 08:44 UTC
From: david at grudl dot com Assigned: laruence
Status: Closed Package: HTTP related
PHP Version: 5.4.0 OS:
Private report: No CVE-ID:
 [2012-04-02 23:20 UTC] david at grudl dot com
Description:
------------
header_remove($name) removes only one header $name. The function header() behaves the same way and replaces only first header.

Test script:
---------------
header('A: first');
header('A: second', FALSE); // append

// removes only 'A: first' and header 'A: second' is sent
header_remove('A');



Expected result:
----------------
no 'A' header is sent

Actual result:
--------------
header A: second is sent

Patches

0001-Fixed-bug-61605-header_remove-does-not-remove-all-headers (last revision 2012-04-03 17:44 UTC) by reeze dot xia at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-03 02:29 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2012-04-03 02:29 UTC] aharvey@php.net
Which SAPI are you using? CGI, FPM, Apache2 handler, Apache2 filter, something 
else?
 [2012-04-03 12:08 UTC] david at grudl dot com
I am using cgi-fci. Now I found that it works correctly with apache2handler.
 [2012-04-03 12:08 UTC] david at grudl dot com
-Status: Feedback +Status: Open
 [2012-04-03 17:41 UTC] reeze dot xia at gmail dot com
Hi, 
   after looking at the code,I found that SAPI it self did't handle multiple 
headers properly, apache2handler handles it for itself. so apache2handler can 
remove correctly.

   SAPI headers are saved in zend_llist. when try to remove or replace it simply 
try to find the first one it found. I've looked at sapi/cli&cgi they both didn't 
handle it itself.
   Sine header() doc says: "The optional replace parameter indicates whether the 
header should replace a previous similar header". but it did't behavior like 
this.
    So I made a patch for this. can someone review this pull request for me?
    https://github.com/php/php-src/pull/36

thanks.
 [2012-04-04 08:02 UTC] laruence@gmail.com@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=896c4539df4de06b4359bac9d0e6a397665e2024
Log: Fixed bug #61605 (header_remove() does not remove all headers)
 [2012-04-04 08:14 UTC] laruence@gmail.com@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=efd671f242e87e3301a1b3e76179955f26119feb
Log: Fixed bug Fixed bug #61605 (header_remove() does not remove all headers)
 [2012-04-04 08:14 UTC] laruence@gmail.com@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=896c4539df4de06b4359bac9d0e6a397665e2024
Log: Fixed bug #61605 (header_remove() does not remove all headers)
 [2012-04-04 08:17 UTC] laruence@gmail.com@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=efd671f242e87e3301a1b3e76179955f26119feb
Log: Fixed bug Fixed bug #61605 (header_remove() does not remove all headers)
 [2012-04-04 08:17 UTC] laruence@gmail.com@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=896c4539df4de06b4359bac9d0e6a397665e2024
Log: Fixed bug #61605 (header_remove() does not remove all headers)
 [2012-04-04 08:44 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2012-04-04 08:44 UTC] laruence@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 08:02:55 2014 UTC