Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-8806

Broken cache behavior in feed.php

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 3.0.x
    • Fix Version/s: 3.0.6
    • Component/s: Other
    • Labels:
      None
    • Environment:
      PHP Environment:
      Database:

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: