php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15038 replace parameter of Header() function doesn't work in Apache module
Submitted: 2002-01-15 00:46 UTC Modified: 2002-09-21 10:46 UTC
Votes:8
Avg. Score:4.5 ± 0.9
Reproduced:8 of 8 (100.0%)
Same Version:4 (50.0%)
Same OS:4 (50.0%)
From: phpman at toowards dot com Assigned:
Status: Closed Package: Apache related
PHP Version: 4.3.0-dev OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phpman at toowards dot com
New email:
PHP Version: OS:

 

 [2002-01-15 00:46 UTC] phpman at toowards dot com
The code (from the Header() manual page)

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // always modified
header("Cache-Control: no-store, no-cache, must-revalidate");  
    // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
    // HTTP/1.0

only outputs a single "Cache-control" - the second one.

It seems to me that the "replace" flag of sapi_header was never being checked. 

I've written a fix for this though as shown below. I hope this is right, and that it is useful to someone :-)


diff -aur php-4.1.0/sapi/apache/mod_php4.c php-4.1.0-tt/sapi/apache/mod_php4.c
--- php-4.1.0/sapi/apache/mod_php4.c    Mon Sep 17 01:49:55 2001
+++ php-4.1.0-tt/sapi/apache/mod_php4.c Tue Jan 15 16:15:28 2002
@@ -206,8 +206,10 @@
                r->content_type = pstrdup(r->pool, header_content);
        } else if (!strcasecmp(header_name, "Set-Cookie")) {
                table_add(r->headers_out, header_name, header_content);
-       } else {
+       } else if ( sapi_header->replace ) {
                table_set(r->headers_out, header_name, header_content);
+       } else {
+               table_add(r->headers_out, header_name, header_content);
        }
 
        *p = ':';  /* a well behaved header handler shouldn't change its original arguments */


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-13 16:46 UTC] edink@php.net
There were some recent changes to this code. Could you please try http://snaps.php.net/php4-latest.tar.gz
 [2002-07-20 02:21 UTC] phpman at toowards dot com
latest cvs fixes this problem
see bug #16458
 [2002-08-22 01:27 UTC] phpman at toowards dot com
This problem has returned using the current cvs
 [2002-08-22 17:20 UTC] sniper@php.net
Which version is it? Please update this report to have the correct version number.

 [2002-08-22 18:56 UTC] phpman at toowards dot com
using php4-200208221500
 [2002-09-21 10:46 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 22:01:30 2024 UTC