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

Local URL truncation from link helper truncate_local_url does not work correctly

    XMLWordPrintable

Details

    Description

      \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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: