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

Local URL truncation from link helper truncate_local_url does not work correctly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.3.1-RC1
    • 3.2.9, 3.3.0
    • BBCode Engine
    • None

      \phpbb\textformatter\s9e\link_helper does not correctly handle local URLs for multiple reasons:

      1. It doesn’t ignore www. subdomain prefix so www.example.com and example.com are treated differently
      2. It doesn’t ignore the protocol-part of the URL, so http://example.com, https://example.com, and //example.com are treated differently
      3. The call to generate_board_url() is memoized in the text formatter cache since it happens during parser configuration time, and generate_board_url() learns the board URL from the current request unless a non-standard configuration is used, so whoever visits the site and instantiates the parser for the first time after a cache clear is the one that ends up setting the “local board URL” for every future parse.
      4. Changing the server configuration options in ACP does not clear the text formatter cache even though this code is dependent on those options due to the generate_board_url() call.
      5. The truncation is handled at parse time instead of render time, so if the board settings change, URLs which are no longer local are still stored in a truncated form in the database. This also makes it impossible to fix improperly truncated URLs without reparsing the whole posts database.

            Marc Marc
            Snover Snover [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: