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

Fulltext native search, wildcard * does not get escaped leading to long execution time

    Details

    • Type: Bug
    • Status: Unverified Fix
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.7-PL1
    • Fix Version/s: 3.0.8-RC1
    • Component/s: Search
    • Labels:
      None
    • Environment:
      PHP 5.1.6, MySQL 5.1.41

      Description

      Fulltext native search.

      Search keywords examples:

      (*)
      |*|*|
      *|keyword
      

      Then you get:

      SELECT p.post_id FROM (phpbb_search_wordlist w0, phpbb_search_wordmatch m0) LEFT JOIN phpbb_posts p ON (m0.post_id = p.post_id) WHERE w0.word_text LIKE '%' AND m0.word_id = w0.word_id AND p.post_approved = 1 AND p.forum_id NOT IN (100, 101, 102, 103, 104, 105, 106) GROUP BY p.post_id, p.post_time ORDER BY p.post_time DESC
      LIMIT 250;

      The important part is:
      word_text LIKE '%'

      This will cause long execution time on big boards with large phpbb_search_wordmatch table. This will lead to table lock on other tables causing board to crash.

      Confirmed with version 3.0.2 and 3.0.7-PL1

        Activity

        Hide
        ToonArmy Chris Smith added a comment -

        I think the fix could be improved but this seems to work and is not so intrusive.

        Show
        ToonArmy Chris Smith added a comment - I think the fix could be improved but this seems to work and is not so intrusive.

          People

          • Assignee:
            ToonArmy Chris Smith
            Reporter:
            alex-An-70 alex-An-70 [X] (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development