Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784

git-svn-id: https://develop.svn.wordpress.org/trunk@8572 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2008-08-06 20:31:54 +00:00
parent 3937bd9530
commit 3cab99fbd2
22 changed files with 125 additions and 124 deletions

View File

@@ -214,7 +214,7 @@ function is_page ($page = '') {
$page = (array) $page;
if ( in_array( $page_obj->ID, $page ) )
if ( in_array( $page_obj->ID, $page ) )
return true;
elseif ( in_array( $page_obj->post_title, $page ) )
return true;
@@ -990,7 +990,7 @@ class WP_Query {
}
$n = ($q['exact']) ? '' : '%';
$searchand = '';
foreach((array)$q['search_terms'] as $term) {
foreach( (array) $q['search_terms'] as $term) {
$term = addslashes_gpc($term);
$search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
$searchand = ' AND ';
@@ -1015,7 +1015,7 @@ class WP_Query {
$cat_array = preg_split('/[,\s]+/', $q['cat']);
$q['cat'] = '';
$req_cats = array();
foreach ( $cat_array as $cat ) {
foreach ( (array) $cat_array as $cat ) {
$cat = intval($cat);
$req_cats[] = $cat;
$in = ($cat > 0);