[wp-trac] [WordPress Trac] #62342: wpdb->get_table_from_query: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated

WordPress Trac noreply at wordpress.org
Fri Jan 24 11:25:18 UTC 2025


#62342: wpdb->get_table_from_query: preg_match(): Passing null to parameter #2
($subject) of type string is deprecated
--------------------------------------+------------------------------
 Reporter:  kkmuffme                  |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Database                  |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by apermo):

 Hey @kkmuffme I ran into a similar issue via our sentry.

 Mine throws `Deprecated: preg_match(): Passing null to parameter #2
 ($subject) of type string is deprecated`

 in https://core.trac.wordpress.org/browser/tags/6.7/src/wp-includes/class-
 wpdb.php#L3819
 {{{#!php
 <?php
 if ( preg_match(
 '/^\s*SHOW\s+(?:TABLE\s+STATUS|(?:FULL\s+)?TABLES)\s+(?:WHERE\s+Name\s+)?LIKE\s*("|\')((?:[\\\\0
 -9a-zA-Z$_.-]|[\xC2-\xDF][\x80-\xBF])+)%?\\1/is', $query, $maybe ) ) {
         return str_replace( '\\_', '_', $maybe[2] );
 }
 }}}

 In my case I can follow the trace down to a `update_option()` where it
 ultimately begins, so I think this is exactly the same issue as yours and
 should be covered by your PR.

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


More information about the wp-trac mailing list