Query: Discard non-scalar 'm' instead of attempting to sanitize.

`WP_Query` discards most non-array date values ('year', 'monthnum', etc) by
casting to integer. Since [25138], the 'm' parameter has been handled
as a string; see #24884. However, the string-handling introduced in [25138]
blindly attempted to handle arrays and other non-scalar types as strings,
resulting in PHP notices and invalid MySQL syntax.

Props vortfu.
Fixes #36718.
Built from https://develop.svn.wordpress.org/trunk@37324


git-svn-id: http://core.svn.wordpress.org/trunk@37290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-04-29 13:15:30 +00:00
parent 15eaa665c1
commit 9bf510260f
2 changed files with 2 additions and 2 deletions

View File

@ -1593,7 +1593,7 @@ class WP_Query {
$qv['monthnum'] = absint($qv['monthnum']);
$qv['day'] = absint($qv['day']);
$qv['w'] = absint($qv['w']);
$qv['m'] = preg_replace( '|[^0-9]|', '', $qv['m'] );
$qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : '';
$qv['paged'] = absint($qv['paged']);
$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-alpha-37323';
$wp_version = '4.6-alpha-37324';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.