"Passed variable is not an array or object" in WP_Query::get_queried_object()
|Reported by:||onetarek||Owned by:||wonderboymusic|
Today I found following warning message by wordpress/PHP
[22-Sep-2012 11:00:16] PHP Warning: reset() [<a href='function.reset'>function.reset</a>]: Passed variable is not an array or object in /home/..../public_html/wp-includes/query.php on line 2971
This warning is not occurred for every page visit/query. But it is huge in my error_log.
I opened wp-includes/query.php on line 2971 and found this line
$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
in some case this variable
is not an object/array.
Now wordpress should check whether this var is an object/array or not before reset() that.
Change History (7)
comment:3 wonderboymusic — 14 months ago
- Keywords has-patch added; needs-testing dev-feedback needs-patch removed
- Milestone changed from Awaiting Review to 3.5
- Owner set to wonderboymusic
- Status changed from new to accepted
- Keywords commit added
- Priority changed from normal to low
- Severity changed from major to minor
- Summary changed from WordPress Bug - PHP Warning Message "Passed variable is not an array or object" to "Passed variable is not an array or object" in WP_Query::get_queried_object()