mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 10:44:26 +00:00
Query: Fix warning on counting non countable
Adds tests to continue the behavior for both null and strings. See https://wiki.php.net/rfc/counting_non_countables for information on the PHP change. Fixes #42860. Props janak007 and ayeshrajans for initial patches. git-svn-id: https://develop.svn.wordpress.org/trunk@42581 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3158,7 +3158,15 @@ class WP_Query {
|
||||
*/
|
||||
$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
|
||||
} else {
|
||||
$this->found_posts = count( $this->posts );
|
||||
if ( is_array( $this->posts ) ) {
|
||||
$this->found_posts = count( $this->posts );
|
||||
} else {
|
||||
if ( null === $this->posts ) {
|
||||
$this->found_posts = 0;
|
||||
} else {
|
||||
$this->found_posts = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user