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

Incorrect styles search order, locator's inability to use template inheritance for extensions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.1.0-a1
    • 3.1.0-dev
    • Extensions, Sessions
    • None

      There are 2 bugs related to template locator class, both can be fixed at the same time by improving locator functionality.

      RFC: http://area51.phpbb.com/phpBB/viewtopic.php?f=108&t=42721

      To describe all bugs I'll use this example setup: 2 templates (progreen, inherits from prosilver), 3 extensions (ext1, ext2, ext3). ext1 has prosilver templates, ext2 has prosilver and progreen templates, ext3 has "all" templates.

      Bug 1: incorrect path location order when template inheritance and extensions are present.

      With that setup, locator's $path variable looks like this:

      1. ext/ext1/styles/prosilver/template
      2. ext/ext2/styles/progreen/template
      3. ext/ext2/styles/prosilver/template
      4. styles/progreen/template/
      5. styles/prosilver/template/

      Number 4 is main template. Current search path is 4, 1, 2, 3, 4, 5

      Locator searches only in main style's directory, then extensions and only then parent style's directory. It also checks number 4 twice. Correct order should be 4, 5, 1, 2, 3

      Bug 2: template inheritance is ignored for events.

      In current version of events PR, template filter is responsible for locating templates, it uses finder for it without accounting for template inheritance. For example above, it means templates in progreen directory will not be searched. So it isn't searching half of directories that it should search in.

      If locator is used to locate template instead of finder, it doesn't distinguish between extension and style. If a template is located in both prosilver and progreen in same extension, both files will be included.

      RFC linked above solves both bugs.

            Arty Vjacheslav Trushkin [X] (Inactive)
            Arty Vjacheslav Trushkin [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: