[wp-trac] [WordPress Trac] #38751: WPDB: get_table_from_query leaves SHOW results LIKE-escaped

WordPress Trac noreply at wordpress.org
Mon Nov 14 00:48:54 UTC 2016


#38751: WPDB: get_table_from_query leaves SHOW results LIKE-escaped
-------------------------------------------------+-------------------------
 Reporter:  andy                                 |       Owner:  pento
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  4.6.2
Component:  Database                             |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch reporter-feedback has-     |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------

Comment (by pento):

 [attachment:38751.3.diff] pulls in one of the fixes I missed from
 [attachment:38751.diff] - `WHERE Name LIKE` syntax is now supported. It
 also adds a bunch more unit tests.

 I'm not wild about this part of the regex:
 `(?:LIKE\s+|WHERE\s+Name(?:\s*=\s*|\s+LIKE\s+))`. It feels more
 complicated than it needs to be, but I suspect the alternatives are to
 start using lookarounds (I really don't want to add that complexity to the
 regex), or to allow invalid SQL syntax (ie,
 `(?:WHERE\s+Name)?(?:\s*=\s*|\s+LIKE\s+)` will work, but will also match
 the invalid query `SHOW TABLES = 'foo'`).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38751#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list