ZF-3076: Zend_Cache_Frontend_Page empty cache on non 200 HTTP status
I have come across a serious problem with using Frontent_Page when implementing additional HTTP status.
This includes the problem in issue #ZF-2841, but has more serious implications.
The frontend cache's a page no matter what HTTP status was sent in the response, and then serves it as though it was a HTTP/1.x 200 OK.
I have implemented correct Last-Modified/If-Modified-Since behaviour in my website, and so it sends a HTTP/1.1 304 Not Modified when the browser has an up to date cache.
The problem is, when I change the http status (php function header()), I exit the request, as is meant to be done. The ob_start callback then caches the blank response. Once this is in the cache, it will be served as a blank page on subsiquent requests.
I would assume this would happen on any other HTTP status which involves any other way of sending alternative content/behaviour (e.g. 206, 301, 307 even 404s?). The correct behaviour would be to only cache if the HTTP status was 200 (or have some alternative storage for redirects).
I have tried looking for a php solution that would return the sent status, but not found any. Sadly headers_list does not include this. So I think the only way to fix this is to modify the php binary itself to include something that does this. Alternatively any cache/redirect/etc behaviour would need to be registered before hand by a Zend php class, but this wouldn't be ideal.