zendframework / zf1

This project reached its end-of-life on 2016-09-28. Contains conversion of ZF1 subversion repo to git, from version 15234 forward, and only containing master and release-1.12 branches and 1.12 tags.
https://framework.zend.com/blog/2016-06-28-zf1-eol.html
BSD 3-Clause "New" or "Revised" License
357 stars 800 forks source link

Zend Page Cache - saved cache is empty #113

Open Benno007 opened 11 years ago

Benno007 commented 11 years ago

Somehow, Zend Page Cache is able to cache completely empty pages (that should have content). The $data it saves can be completely empty in certain circumstances.

I have no idea how it happens, but one way is from a server performing a HEAD request on a page. It seems to save the empty response body of the HEAD request to a cache file. I've seen this by adding logging where it posts the $_SERVER variables to the text file along with the $data. $data is empty, but $_SERVER['REQUEST_METHOD'] is HEAD.

Other ways the cache is sometimes empty seems to be from Baidu spider and yandex spider. I honestly cannot figure this out.

Due to the nature of the page cache dieing after it echo's the $data on _flush, this results in an empty page being served to users. I've had to modify _flush to add:

if(empty($data)) return true; else die();

Has anyone else ever experienced this? Is there any other way to fix it?

froschdesign commented 11 years ago

Is this a question or an error reporting? For questions please use the mailing lists or stackoverflow.

Benno007 commented 11 years ago

Sorry, I’m not sure. Is it expected behaviour to cache pages with completely empty contents? Wouldn’t that be kind of useless?

I’ve tried posting on SO and no one has been able to tell me what’s wrong.

From: Frank Brückner Sent: Friday, May 31, 2013 4:07 PM To: zendframework/zf1 Cc: Ben Subject: Re: [zf1] Zend Page Cache - saved cache is empty (#113)

Is this a question or an error reporting? For questions please use the mailing lists or stackoverflow.

— Reply to this email directly or view it on GitHub.