Query: Non-scalar and negative values for 'p' should always result in a 404.

Previously, the 'p' query var was being run through `absint()`, which
caused unexpected results.

Props Akeif, kouratoras.
Fixes #33372.
Built from https://develop.svn.wordpress.org/trunk@38288


git-svn-id: http://core.svn.wordpress.org/trunk@38229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2016-08-20 02:32:30 +00:00
parent 54fe38c7cc
commit d30a6a988a
2 changed files with 8 additions and 2 deletions

View File

@ -1602,7 +1602,13 @@ class WP_Query {
if ( ! empty($qv['robots']) )
$this->is_robots = true;
$qv['p'] = absint($qv['p']);
if ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) {
$qv['p'] = 0;
$qv['error'] = '404';
} else {
$qv['p'] = intval( $qv['p'] );
}
$qv['page_id'] = absint($qv['page_id']);
$qv['year'] = absint($qv['year']);
$qv['monthnum'] = absint($qv['monthnum']);

View File

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