From d30a6a988acecd86907d2e0cfd31a905e192c3f7 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sat, 20 Aug 2016 02:32:30 +0000 Subject: [PATCH] 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 --- wp-includes/query.php | 8 +++++++- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index ea6ec2aafd..ee7a8c703d 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -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']); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3ef1c2d903..01ce236ca2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.