Make WordPress Core


Ignore:
Timestamp:
08/06/2008 08:31:54 PM (13 years ago)
Author:
markjaquith
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r8555 r8572  
    215215    $page = (array) $page;
    216216
    217     if ( in_array( $page_obj->ID, $page ) )
     217    if ( in_array( $page_obj->ID, $page ) )
    218218        return true;
    219219    elseif ( in_array( $page_obj->post_title, $page ) )
     
    991991            $n = ($q['exact']) ? '' : '%';
    992992            $searchand = '';
    993             foreach((array)$q['search_terms'] as $term) {
     993            foreach( (array) $q['search_terms'] as $term) {
    994994                $term = addslashes_gpc($term);
    995995                $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
     
    10161016            $q['cat'] = '';
    10171017            $req_cats = array();
    1018             foreach ( $cat_array as $cat ) {
     1018            foreach ( (array) $cat_array as $cat ) {
    10191019                $cat = intval($cat);
    10201020                $req_cats[] = $cat;
Note: See TracChangeset for help on using the changeset viewer.