WPDB: When extracting the table name from a query, we had a 1000 character limit on the SQL string that would be searched. This was a hangover from when the code was imported from HyperDB, and isn't appropriate for Core, where a wider range of queries are likely to be run.

Fixes #32763


Built from https://develop.svn.wordpress.org/trunk@33259


git-svn-id: http://core.svn.wordpress.org/trunk@33231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2015-07-14 10:19:24 +00:00
parent 43077a6ef8
commit 4ee0da1798
2 changed files with 3 additions and 6 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta2-33257';
$wp_version = '4.3-beta2-33259';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -2868,11 +2868,8 @@ class wpdb {
// Allow (select...) union [...] style queries. Use the first query's table name.
$query = ltrim( $query, "\r\n\t (" );
/*
* Strip everything between parentheses except nested selects and use only 1,000
* chars of the query.
*/
$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', substr( $query, 0, 1000 ) );
// Strip everything between parentheses except nested selects.
$query = preg_replace( '/\((?!\s*select)[^(]*?\)/is', '()', $query );
// Quickly match most common queries.
if ( preg_match( '/^\s*(?:'