Ticket #542 (closed defect: fixed)

Opened 9 months ago

Last modified 9 months ago

WordPress on-disk cache broken

Reported by: dreamer12345 Assigned to: donncha
Priority: high Milestone: WPMU 1.0
Component: component1 Version:
Severity: major Keywords: has-patch
Cc:

Description

Hello,

I discovered a bug with the on-disk cache in WordPress? MU 1.3: it is broken and will work in no (or nearly no) situations. This is because the filename generation of a cached file of the method which loads the cache file is different from the one of the method which saves this cache file.

The filename of the WP_Object_Cache::get method is made with a hash of the ID of the cache entry (wp-includes/cache.php, line 171) while the filename of the WP_Object_Cache::save method is made with a hash of the group AND the ID of the cache entry (wp-includes/cache.php, line 341).

One of the possible bug fix -> on line 171, replace: $cache_file = $this->cache_dir.$this->get_group_dir($group_key)."/".$this->hash($id).'.php'; by: $cache_file = $this->cache_dir.$this->get_group_dir($group_key)."/".$this->hash($hash).'.php';

Thank you for your attention :-)

Frédéric.

Change History

01/12/08 06:35:14 changed by lunabyte

Confirmed.

01/12/08 06:35:22 changed by lunabyte

  • severity changed from normal to major.

01/13/08 16:08:25 changed by drmiketemp

  • keywords set to has-patch.

The patch/fix/"that line of code up there that's been edited" appears to have fixed the issue.

01/15/08 11:57:59 changed by donncha

  • owner changed from somebody to donncha.
  • status changed from new to assigned.

Thanks for spotting that and reporting it. In [1187] I checked this in and more cleanups. Can you verify that it works for you and I'll close this bug?

01/15/08 16:48:43 changed by lunabyte

I tried the above fix on r1185 and it seemed to work out fine.

01/16/08 12:29:10 changed by donncha

  • status changed from assigned to closed.
  • resolution set to fixed.