Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-8806

Broken cache behavior in feed.php

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 3.0.6
    • 3.0.x
    • Other
    • None
    • PHP Environment:
      Database:

      This was found in 3.0.6-RC3's feed.php. It looks to me like the version in SVN trunk (http://code.phpbb.com/svn/phpbb/trunk/phpBB/feed.php) has the same issue.

      Incorrect results are served if you fetch multiple individual forum/topic feeds within $cache_time. I.e. fetch feed.php?f=1, feed.php?f=2, feed.php?f=3, ... within cache_time, and all will contain the same data. This only applies to anon/guests, as the cache is auto-inhibited for logged in users. I think it applies to bots too.

      Very quick workaround (not ideal): $cache_time=0;

      Most obvious fix that springs to mind, in phpbb_feed::get_item():

      Find:

                                      // Try to load result set...
                                      $cache_filename = substr(get_class($this), strlen('phpbb_'));

      Add:

                                      if (!$this->topic_id && $this->forum_id)
                                      {
                                              $cache_filename .= '_forum_' . $this->forum_id;
                                      }
                                      else if ($this->topic_id)
                                      {
                                              $cache_filename .= '_topic_' . $this->topic_id;
                                      }

      This does raise the issue of potentially creating a very large number of files in the cache directory, which is not exactly ideal, but retaining caching without creating so many files would need quite a bit more work - that's the quick fix and should be ok on smaller boards, I'd guess.

      One relatively obvious way of addressing the number of cache files would be to store the results in a simple (forum_id, topic_id, timestamp, data) DB table.

            Acyd Burn Meik Sievertsen [X] (Inactive)
            paul.j.murphy paul.j.murphy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: