Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.1

Bug #5404 Headers cannot be unset
Submitted: 2005-09-14 21:14 UTC
From: gugglegum at gmail dot com Assigned: mike
Status: Closed Package: HTTP_Header
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 33 - 15 = ?

 [2005-09-14 21:14 UTC] gugglegum at gmail dot com
Description: ------------ HTTP_Header class declares property $_headers, which initially contains several headers, that are sent by default (you say). This is wrong. At least at my side, PHP does not send any headers that prevent caching. In order to prove it, this is HTTP request made by terminal (manually) to empty PHP-script (script that contains only <?php ?>): -------------------------------------- GET /test.php HTTP/1.1 Host: HTTP/1.1 200 OK Date: Wed, 14 Sep 2005 20:58:25 GMT Server: Apache/1.3.33 (Win32) PHP/5.0.5 X-Powered-By: PHP/5.0.5 Transfer-Encoding: chunked Content-Type: text/html 0 -------------------------------------- As you can see here - there are no Pragma and Cache-Control headers. Though maybe it really was in past. My task is to allow clients to cache pages - I'm sending correct Last-Modified header and handle If-Modified-Since http-request header. So, your "Pragma: no-cache" and "Cache-Control: no-store, no-cache, ..." Is a trouble for me. This trouble can be workarounded by resetting these headers but, there is no any way to remove previously assigned header. I do: $httpHeaders->setHeader('pragma', null); $httpHeaders->setHeader('cache-control', null); It works, but these headers still sends empty: -------------------------------------- GET / HTTP/1.1 Host: HTTP/1.1 200 OK Date: Wed, 14 Sep 2005 21:05:04 GMT Server: Apache/1.3.33 (Win32) PHP/5.0.5 X-Powered-By: PHP/5.0.5 pragma: cache-control: last-modified: Wed, 14 Sep 2005 19:40:40 GMT Transfer-Encoding: chunked Content-Type: text/html; charset=windows-1251 -------------------------------------- I think this is unpretty. My suggestion is to keep initially empty $_headers property and add modify setHeader() method, which remove header if it new value === null (not "" or 0).


 [2005-09-14 21:31 UTC] gugglegum at gmail dot com
I have modified this class for instant needs. You can get my modified version at
 [2005-09-15 06:55 UTC] mike
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Hi, the HTTP_Header class at its own is pretty useless; if you want caching functionality by Last-Modified, take a look at the HTTP_Header_Cache class also in the HTTP_Header package. I changed the summary of your report, because I'll fix exactly what is broken, namely that headers cannot be unset. Is that fine for you? Thanks.
 [2005-09-15 07:17 UTC] gugglegum at gmail dot com
Yes, thank you.