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

sql_like_expression() doesn't handle underscores correctly

XMLWordPrintable

      Having an underscore in the sql_like_expression() fails. The underscore ends up being double escaped (in MySQL, not sure about other DBMs).

      It is escaped in the sql_like_expression() function itself. Then it gets escaped again by the sql_escape() function.

      For example,

      $db->sql_like_expression('foo_' . $db->get_any_char())
      

      Results in a bad MYSQL error:

      LIKE 'FOO\\_%'
      

      To work it must be:

      LIKE 'FOO\_%'
      

            Unassigned Unassigned
            VSE Matt Friedman [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: