[wp-trac] [WordPress Trac] #50789: Improve WPDB logic around information_schema

WordPress Trac noreply at wordpress.org
Thu Jun 10 21:27:38 UTC 2021


#50789: Improve WPDB logic around information_schema
--------------------------+------------------------------
 Reporter:  andy          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Database      |     Version:  5.5
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:  multisite
--------------------------+------------------------------

Comment (by rfair404):

 @andy I'm working on an issue in a site that uses LudicrousDB (fork of
 HyperDB) that ran into a similar issue when using the plugin **multisite-
 clone-duplicator** which also seems to query the information schema. The
 query looks like this:
 {{{#!php
 <?php
 $wpdb->prepare('SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE
 TABLE_SCHEMA = \'%s\' AND TABLE_NAME LIKE \'%s\'', $schema,
 $from_site_prefix_like . '%');
 }}}

 The REGEX in get_table_from_query indeed collects the
 **INFORMATION_SCHEMA.TABLE_NAME** as demonstrated here:
 https://www.phpliveregex.com/p/AIE

 Curious if a possible solution here might be to simply add a filter to the
 REGEX patterns (allowing more specific regex patterns to be injected) so
 that these queries could be handled in situations like these (edge cases).

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


More information about the wp-trac mailing list