Query: Ensure that the `page` parameter is scalar in `WP_Query::get_posts()`.
The `page` query var only accepts a scalar value and passes the value through functions that assume a scalar value. Adding an extra guard condition does not affect its functionality but does avoid a PHP fatal error for `trim()` when a non-scalar value such as an array is passed. Follow-up to [2535], [53891]. Props brookedot, rlmc, mukesh27, SergeyBiryukov. Fixes #56558. Built from https://develop.svn.wordpress.org/trunk@56815 git-svn-id: http://core.svn.wordpress.org/trunk@56327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
57ecd6c091
commit
330f070340
|
@ -2020,8 +2020,7 @@ class WP_Query {
|
|||
}
|
||||
|
||||
if ( isset( $q['page'] ) ) {
|
||||
$q['page'] = trim( $q['page'], '/' );
|
||||
$q['page'] = absint( $q['page'] );
|
||||
$q['page'] = is_scalar( $q['page'] ) ? absint( trim( $q['page'], '/' ) ) : 0;
|
||||
}
|
||||
|
||||
// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.4-beta2-56814';
|
||||
$wp_version = '6.4-beta2-56815';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue