?
avatar weeblr
weeblr
2 May 2017

In 3.7.0, under some circumstances, enabling the Cache system plugin can result in white pages for some pages

Steps to reproduce the issue

  1. Enable Cache system plugin
  2. Go to its parameters and exclude one or more menu items from caching
  3. Visit said menu item -> all good
  4. Visit a second time -> white page

Expected result

The page should display the same regardless of whether it's been viewed before.

Actual result

You get a white page.

System information (as much as possible)

Happens if using file for storage.

Additional comments

This is caused by a change in the lock function of the file cache storage backend: https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/cache/storage/file.php#L354

It was changed from (J! 3.6.5)

$_fileopen = @fopen($path, 'r+b');

to (J! 3.7.0)

$_fileopen = @fopen($path, 'c+b');

This causes the cache file for a given page to be created when we check for its existence (it's created with an empty content of course) during onAfterInitialize.

Now later on, during onAfterRespond, nothing is stored in that file, because the menu item has been excluded from caching, but the empty file is still there.

Upon subsequent requests for the same page, the empty file is found during onAfterInitialize and thus loaded and displayed, resulting in a white page.

I don't know why this was changed, but I suspect this should simply be reverted. An alternative would be to only display the cached content if the cache file is not empty, but that doesn't sound right.

Change: d2dd941

Note: I only tested this on windows, but PHP's fopen c flag is supposed to behave the same on all systems, and will create that file. I do have reports from users experiencing the same on standard hosting, which is why I looked into it.

/cc @csthomas @mbabker

avatar weeblr weeblr - open - 2 May 2017
avatar joomla-cms-bot joomla-cms-bot - change - 2 May 2017
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 2 May 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 2 May 2017
Category com_cache
avatar csthomas
csthomas - comment - 2 May 2017

It is done at #15592

avatar weeblr
weeblr - comment - 2 May 2017

Ah crap, I did search quite a bit, including the closed issues!

avatar weeblr weeblr - change - 2 May 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-05-02 10:03:14
Closed_By weeblr
avatar weeblr weeblr - close - 2 May 2017
avatar Bertram25
Bertram25 - comment - 20 Aug 2017

I have a similar issue with firefox 55.0 (64 bits) - Debian Sid on github.com

avatar brianteeman
brianteeman - comment - 20 Aug 2017

Please create a new issue as comments on closed issues will not be seen

Add a Comment

Login with GitHub to post a comment