Ticket #2784: arraytypecast.patch
| File arraytypecast.patch, 43.0 KB (added by , 18 years ago) |
|---|
-
capabilities.php
28 28 29 29 $this->role_objects = array(); 30 30 $this->role_names = array(); 31 foreach ( $this->roles as $role => $data) {31 foreach ( (array) $this->roles as $role => $data) { 32 32 $this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']); 33 33 $this->role_names[$role] = $this->roles[$role]['name']; 34 34 } … … 207 207 } 208 208 209 209 function set_role($role) { 210 foreach( $this->roles as $oldrole)210 foreach( (array) $this->roles as $oldrole) 211 211 unset($this->caps[$oldrole]); 212 212 if ( !empty($role) ) { 213 213 $this->caps[$role] = true; … … 265 265 $caps = call_user_func_array('map_meta_cap', $args); 266 266 // Must have ALL requested caps 267 267 $capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args); 268 foreach ( $caps as $cap) {268 foreach ( (array) $caps as $cap) { 269 269 //echo "Checking cap $cap<br />"; 270 270 if(empty($capabilities[$cap]) || !$capabilities[$cap]) 271 271 return false; -
category-template.php
7 7 $chain = ''; 8 8 // TODO: consult hierarchy 9 9 $cat_ids = get_all_category_ids(); 10 foreach ( $cat_ids as $cat_id ) {10 foreach ( (array) $cat_ids as $cat_id ) { 11 11 if ( $cat_id == $id ) 12 12 continue; 13 13 … … 81 81 else 82 82 $categories = array(); 83 83 84 foreach( array_keys($categories) as $key) {84 foreach( (array) array_keys($categories) as $key) { 85 85 _make_cat_compat($categories[$key]); 86 86 } 87 87 -
category.php
16 16 $taxonomy = 'category'; 17 17 if ( 'link' == $args['type'] ) 18 18 $taxonomy = 'link_category'; 19 $categories = get_terms($taxonomy, $args);19 $categories = (array) get_terms($taxonomy, $args); 20 20 21 21 foreach ( array_keys($categories) as $k ) 22 22 _make_cat_compat($categories[$k]); -
classes.php
89 89 90 90 // Look for matches. 91 91 $request_match = $request; 92 foreach ( $rewrite as $match => $query) {92 foreach ( (array) $rewrite as $match => $query) { 93 93 // If the requesting file is the anchor of the match, prepend it 94 94 // to the path info. 95 95 if ((! empty($req_uri)) && (strpos($match, $req_uri) === 0) && ($req_uri != $request)) { … … 157 157 $this->query_vars[$wpvar] = (string) $this->query_vars[$wpvar]; 158 158 } 159 159 160 foreach ( $this->private_query_vars as $var) {160 foreach ( (array) $this->private_query_vars as $var) { 161 161 if (isset($this->extra_query_vars[$var])) 162 162 $this->query_vars[$var] = $this->extra_query_vars[$var]; 163 163 elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var]) … … 228 228 229 229 function build_query_string() { 230 230 $this->query_string = ''; 231 foreach ( array_keys($this->query_vars) as $wpvar) {231 foreach ( (array) array_keys($this->query_vars) as $wpvar) { 232 232 if ( '' != $this->query_vars[$wpvar] ) { 233 233 $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&'; 234 234 if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars. … … 247 247 function register_globals() { 248 248 global $wp_query; 249 249 // Extract updated query vars back into global namespace. 250 foreach ( $wp_query->query_vars as $key => $value) {250 foreach ( (array) $wp_query->query_vars as $key => $value) { 251 251 $GLOBALS[$key] = $value; 252 252 } 253 253 … … 336 336 // Return all messages if no code specified. 337 337 if ( empty($code) ) { 338 338 $all_messages = array(); 339 foreach ( $this->errors as $code => $messages )339 foreach ( (array) $this->errors as $code => $messages ) 340 340 $all_messages = array_merge($all_messages, $messages); 341 341 342 342 return $all_messages; … … 517 517 * if we are displaying all levels, and remaining children_elements is not empty, 518 518 * then we got orphans, which should be displayed regardless 519 519 */ 520 if ( ( $max_depth == 0 ) && sizeof( $children_elements ) > 0 ) {520 if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) { 521 521 $empty_array = array(); 522 522 foreach ( $children_elements as $orphan_e ) 523 523 $output = $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output ); … … 749 749 750 750 $response = ''; 751 751 if ( is_wp_error($data) ) { 752 foreach ( $data->get_error_codes() as $code ) {752 foreach ( (array) $data->get_error_codes() as $code ) { 753 753 $response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>"; 754 754 if ( !$error_data = $data->get_error_data($code) ) 755 755 continue; … … 775 775 } 776 776 777 777 $s = ''; 778 if ( (array) $supplemental)778 if ( is_array($supplemental) ) 779 779 foreach ( $supplemental as $k => $v ) 780 780 $s .= "<$k><![CDATA[$v]]></$k>"; 781 781 … … 797 797 function send() { 798 798 header('Content-Type: text/xml'); 799 799 echo "<?xml version='1.0' standalone='yes'?><wp_ajax>"; 800 foreach ( $this->responses as $response )800 foreach ( (array) $this->responses as $response ) 801 801 echo $response; 802 802 echo '</wp_ajax>'; 803 803 die(); -
comment-template.php
105 105 */ 106 106 function get_comment_author_link() { 107 107 /** @todo Only call these functions when they are needed. Include in if... else blocks */ 108 $url = get_comment_author_url();108 $url = get_comment_author_url(); 109 109 $author = get_comment_author(); 110 110 111 111 if ( empty( $url ) || 'http://' == $url ) … … 763 763 echo '</a>'; 764 764 } 765 765 766 ?> 767 No newline at end of file 766 ?> -
comment.php
35 35 if ( !empty($mod_keys) ) { 36 36 $words = explode("\n", $mod_keys ); 37 37 38 foreach ( $words as $word) {38 foreach ( (array) $words as $word) { 39 39 $word = trim($word); 40 40 41 41 // Skip empty lines … … 1113 1113 // http://dummy-weblog.org/post.php 1114 1114 // We don't wanna ping first and second types, even if they have a valid <link/> 1115 1115 1116 foreach ( $post_links_temp[0] as $link_test ) :1116 foreach ( (array) $post_links_temp[0] as $link_test ) : 1117 1117 if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself 1118 1118 && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments. 1119 1119 $test = parse_url($link_test); -
cron.php
121 121 $schedules = wp_get_schedules(); 122 122 foreach ( $crons as $timestamp => $cronhooks ) { 123 123 if ( $timestamp > time() ) break; 124 foreach ( $cronhooks as $hook => $args ) {124 foreach ( (array) $cronhooks as $hook => $args ) { 125 125 if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) ) 126 126 continue; 127 127 spawn_cron(); … … 178 178 179 179 $new_cron = array(); 180 180 181 foreach ( $cron as $timestamp => $hooks) {182 foreach ( $hooks as $hook => $args ) {181 foreach ( (array) $cron as $timestamp => $hooks) { 182 foreach ( (array) $hooks as $hook => $args ) { 183 183 $key = md5(serialize($args['args'])); 184 184 $new_cron[$timestamp][$hook][$key] = $args; 185 185 } -
feed.php
148 148 if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) 149 149 return; 150 150 151 foreach ( get_post_custom() as $key => $val) {151 foreach ( (array) get_post_custom() as $key => $val) { 152 152 if ($key == 'enclosure') { 153 foreach ( (array)$val as $enc) {153 foreach ( (array) $val as $enc ) { 154 154 $enclosure = split("\n", $enc); 155 155 echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); 156 156 } … … 163 163 if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) ) 164 164 return; 165 165 166 foreach ( get_post_custom() as $key => $val) {166 foreach ( (array) get_post_custom() as $key => $val ) { 167 167 if ($key == 'enclosure') { 168 foreach ( (array)$val as $enc) {168 foreach ( (array) $val as $enc ) { 169 169 $enclosure = split("\n", $enc); 170 170 echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n"); 171 171 } -
formatting.php
678 678 679 679 function convert_smilies($text) { 680 680 global $wp_smiliessearch, $wp_smiliesreplace; 681 $output = '';681 $output = ''; 682 682 if ( get_option('use_smilies') && !empty($wp_smiliessearch) && !empty($wp_smiliesreplace) ) { 683 683 // HTML loop taken from texturize function, could possible be consolidated 684 684 $textarr = preg_split("/(<.*>)/U", $text, -1, PREG_SPLIT_DELIM_CAPTURE); // capture the tags as well as in between -
functions.php
251 251 $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); 252 252 $wpdb->show_errors($show); 253 253 254 foreach ( $options as $option ) {254 foreach ( (array) $options as $option ) { 255 255 // "When trying to design a foolproof system, 256 256 // never underestimate the ingenuity of the fools :)" -- Dougal 257 257 if ( in_array( $option->option_name, array( 'siteurl', 'home', 'category_base' ) ) ) … … 404 404 function gzip_compression() { 405 405 if ( !get_option( 'gzipcompression' ) || ini_get( 'zlib.output_compression' ) == 'On' || ini_get( 'zlib.output_compression_level' ) > 0 || ini_get( 'output_handler' ) == 'ob_gzhandler' || !extension_loaded( 'zlib' ) ) 406 406 return false; 407 ob_clean_flush(); 407 408 ob_start( 'ob_gzhandler' ); 408 409 } 409 410 … … 505 506 debug_fwrite( $log, 'Post contents:' ); 506 507 debug_fwrite( $log, $content . "\n" ); 507 508 508 foreach ( $post_links_temp[0] as $link_test ) {509 foreach ( (array) $post_links_temp[0] as $link_test ) { 509 510 if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already 510 511 $test = parse_url( $link_test ); 511 512 if ( isset( $test['query'] ) ) … … 515 516 } 516 517 } 517 518 518 foreach ( $post_links as $url ) {519 foreach ( (array) $post_links as $url ) { 519 520 if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $url . '%' ) ) ) { 520 521 if ( $headers = wp_get_http_headers( $url) ) { 521 522 $len = (int) $headers['content-length']; … … 686 687 $qs[func_get_arg( 0 )] = func_get_arg( 1 ); 687 688 } 688 689 689 foreach ( $qs as $k => $v ) {690 foreach ( (array) $qs as $k => $v ) { 690 691 if ( $v === false ) 691 692 unset( $qs[$k] ); 692 693 } … … 712 713 713 714 function remove_query_arg( $key, $query=FALSE ) { 714 715 if ( is_array( $key ) ) { // removing multiple keys 715 foreach ( (array)$key as $k )716 foreach ( $key as $k ) 716 717 $query = add_query_arg( $k, FALSE, $query ); 717 718 return $query; 718 719 } … … 723 724 function add_magic_quotes( $array ) { 724 725 global $wpdb; 725 726 726 foreach ( $array as $k => $v ) {727 foreach ( (array) $array as $k => $v ) { 727 728 if ( is_array( $v ) ) { 728 729 $array[$k] = add_magic_quotes( $v ); 729 730 } else { -
general-template.php
407 407 } 408 408 if ( $arcresults ) { 409 409 $afterafter = $after; 410 foreach ( $arcresults as $arcresult ) {410 foreach ( (array) $arcresults as $arcresult ) { 411 411 $url = get_month_link($arcresult->year, $arcresult->month); 412 412 $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year); 413 413 if ( $show_post_count ) … … 428 428 } 429 429 if ($arcresults) { 430 430 $afterafter = $after; 431 foreach ( $arcresults as $arcresult) {431 foreach ( (array) $arcresults as $arcresult) { 432 432 $url = get_year_link($arcresult->year); 433 433 $text = sprintf('%d', $arcresult->year); 434 434 if ($show_post_count) … … 449 449 } 450 450 if ( $arcresults ) { 451 451 $afterafter = $after; 452 foreach ( $arcresults as $arcresult ) {452 foreach ( (array) $arcresults as $arcresult ) { 453 453 $url = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth); 454 454 $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth); 455 455 $text = mysql2date($archive_day_date_format, $date); … … 473 473 $arc_w_last = ''; 474 474 $afterafter = $after; 475 475 if ( $arcresults ) { 476 foreach ( $arcresults as $arcresult ) {476 foreach ( (array) $arcresults as $arcresult ) { 477 477 if ( $arcresult->week != $arc_w_last ) { 478 478 $arc_year = $arcresult->yr; 479 479 $arc_w_last = $arcresult->week; … … 501 501 $arcresults = $cache[ $key ]; 502 502 } 503 503 if ( $arcresults ) { 504 foreach ( $arcresults as $arcresult ) {504 foreach ( (array) $arcresults as $arcresult ) { 505 505 if ( $arcresult->post_date != '0000-00-00 00:00:00' ) { 506 506 $url = get_permalink($arcresult); 507 507 $arc_title = $arcresult->post_title; … … 641 641 AND post_type = 'post' AND post_status = 'publish' 642 642 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N); 643 643 if ( $dayswithposts ) { 644 foreach ( $dayswithposts as $daywith ) {644 foreach ( (array) $dayswithposts as $daywith ) { 645 645 $daywithpost[] = $daywith[0]; 646 646 } 647 647 } else { … … 662 662 ."AND post_type = 'post' AND post_status = 'publish'" 663 663 ); 664 664 if ( $ak_post_titles ) { 665 foreach ( $ak_post_titles as $ak_post_title ) {665 foreach ( (array) $ak_post_titles as $ak_post_title ) { 666 666 667 667 $post_title = apply_filters( "the_title", $ak_post_title->post_title ); 668 668 $post_title = str_replace('"', '"', wptexturize( $post_title )); … … 729 729 function allowed_tags() { 730 730 global $allowedtags; 731 731 $allowed = ''; 732 foreach ( $allowedtags as $tag => $attributes ) {732 foreach ( (array) $allowedtags as $tag => $attributes ) { 733 733 $allowed .= '<'.$tag; 734 734 if ( 0 < count($attributes) ) { 735 735 foreach ( $attributes as $attribute => $limits ) { … … 926 926 <div id='editor-toolbar' style='display:none;'> 927 927 <div class='zerosize'><input accesskey='e' type='button' onclick='switchEditors("<?php echo $id; ?>")' /></div> 928 928 <a id='edButtonHTML' class='' onclick='switchEditors("<?php echo $id; ?>")'><?php _e('HTML'); ?></a> 929 <a id='edButtonPreview' class='active'><?php _e('Visual'); ?></a>930 <div id="media-buttons">931 <?php _e('Add media:'); ?>932 <?php do_action( 'media_buttons'); ?>933 </div>929 <a id='edButtonPreview' class='active'><?php _e('Visual'); ?></a> 930 <div id="media-buttons"> 931 <?php _e('Add media:'); ?> 932 <?php do_action( 'media_buttons'); ?> 933 </div> 934 934 </div> 935 935 <script type="text/javascript"> 936 936 // <![CDATA[ … … 1049 1049 extract($args, EXTR_SKIP); 1050 1050 1051 1051 // Who knows what else people pass in $args 1052 $total = (int) $total;1052 $total = (int) $total; 1053 1053 if ( $total < 2 ) 1054 1054 return; 1055 1055 $current = (int) $current; -
kses.php
586 586 { 587 587 $outarray = array (); 588 588 589 foreach ( $inarray as $inkey => $inval) {589 foreach ( (array) $inarray as $inkey => $inval) { 590 590 $outkey = strtolower($inkey); 591 591 $outarray[$outkey] = array (); 592 592 593 foreach ( $inval as $inkey2 => $inval2) {593 foreach ( (array) $inval as $inkey2 => $inval2) { 594 594 $outkey2 = strtolower($inkey2); 595 595 $outarray[$outkey][$outkey2] = $inval2; 596 596 } # foreach $inval … … 641 641 $string2 = strtolower($string2); 642 642 643 643 $allowed = false; 644 foreach ( $allowed_protocols as $one_protocol)644 foreach ( (array) $allowed_protocols as $one_protocol) 645 645 if (strtolower($one_protocol) == $string2) { 646 646 $allowed = true; 647 647 break; -
locale.php
100 100 $this->number_format['thousands_sep'] = ('number_format_thousands_sep' == $trans) ? ',' : $trans; 101 101 102 102 // Import global locale vars set during inclusion of $locale.php. 103 foreach ( $this->locale_vars as $var ) {103 foreach ( (array) $this->locale_vars as $var ) { 104 104 if ( isset($GLOBALS[$var]) ) 105 105 $this->$var = $GLOBALS[$var]; 106 106 } -
pluggable.php
451 451 452 452 $auth_cookie = ''; 453 453 $cookie = explode('; ', urldecode(empty($_POST['cookie']) ? $_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass cookie=document.cookie 454 foreach ( $cookie as $tasty ) {454 foreach ( (array) $cookie as $tasty ) { 455 455 if ( false !== strpos($tasty, AUTH_COOKIE) ) 456 456 $auth_cookie = substr(strstr($tasty, '='), 1); 457 457 } … … 506 506 $found = true; 507 507 while($found) { 508 508 $found = false; 509 foreach( $strip as $val) {509 foreach( (array) $strip as $val) { 510 510 while(strpos($location, $val) !== false) { 511 511 $found = true; 512 512 $location = str_replace($val, '', $location); -
plugin.php
90 90 if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) ) 91 91 return false; 92 92 93 foreach ( array_keys($wp_filter[$tag]) as $priority ) {93 foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) { 94 94 if ( isset($wp_filter[$tag][$priority][$idx]) ) 95 95 return $priority; 96 96 } -
post-template.php
250 250 function the_meta() { 251 251 if ( $keys = get_post_custom_keys() ) { 252 252 echo "<ul class='post-meta'>\n"; 253 foreach ( $keys as $key ) {253 foreach ( (array) $keys as $key ) { 254 254 $keyt = trim($key); 255 255 if ( '_' == $keyt{0} ) 256 256 continue; -
post.php
100 100 if ( $output == OBJECT ) { 101 101 return $kids; 102 102 } elseif ( $output == ARRAY_A ) { 103 foreach ( $kids as $kid )103 foreach ( (array) $kids as $kid ) 104 104 $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]); 105 105 return $weeuns; 106 106 } elseif ( $output == ARRAY_N ) { 107 foreach ( $kids as $kid )107 foreach ( (array) $kids as $kid ) 108 108 $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID])); 109 109 return $babes; 110 110 } else { … … 1203 1203 wp_transition_post_status('publish', $old_status, $post); 1204 1204 1205 1205 // Update counts for the post's terms. 1206 foreach ( get_object_taxonomies('post') as $taxonomy ) {1206 foreach ( (array) get_object_taxonomies('post') as $taxonomy ) { 1207 1207 $terms = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids'); 1208 1208 wp_update_term_count($terms, $taxonomy); 1209 1209 } … … 1401 1401 } 1402 1402 1403 1403 $trackback_urls = explode(',', $tb_list); 1404 foreach( $trackback_urls as $tb_url) {1404 foreach( (array) $trackback_urls as $tb_url) { 1405 1405 $tb_url = trim($tb_url); 1406 1406 trackback($tb_url, stripslashes($post_title), $excerpt, $post_id); 1407 1407 } … … 1482 1482 $page_paths = '/' . trim($page_path, '/'); 1483 1483 $leaf_path = sanitize_title(basename($page_paths)); 1484 1484 $page_paths = explode('/', $page_paths); 1485 foreach( $page_paths as $pathdir)1485 foreach( (array) $page_paths as $pathdir) 1486 1486 $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 1487 1487 1488 1488 $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = 'page' OR post_type = 'attachment')", $leaf_path )); … … 1543 1543 */ 1544 1544 function &get_page_children($page_id, $pages) { 1545 1545 $page_list = array(); 1546 foreach ( $pages as $page ) {1546 foreach ( (array) $pages as $page ) { 1547 1547 if ( $page->post_parent == $page_id ) { 1548 1548 $page_list[] = $page; 1549 1549 if ( $children = get_page_children($page->ID, $pages) ) … … 1569 1569 */ 1570 1570 function get_page_hierarchy($posts, $parent = 0) { 1571 1571 $result = array ( ); 1572 if ($posts) { foreach ( $posts as $post) {1572 if ($posts) { foreach ( (array) $posts as $post) { 1573 1573 if ($post->post_parent == $parent) { 1574 1574 $result[$post->ID] = $post->post_name; 1575 1575 $children = get_page_hierarchy($posts, $post->ID); … … 2513 2513 $cache[$id] = array(); 2514 2514 } 2515 2515 2516 foreach ( array_keys($cache) as $post)2516 foreach ( (array) array_keys($cache) as $post) 2517 2517 wp_cache_set($post, $cache[$post], 'post_meta'); 2518 2518 2519 2519 return $cache; -
query.php
153 153 $page_obj = $wp_query->get_queried_object(); 154 154 155 155 $page = (array) $page; 156 157 if ( in_array( $page_obj->ID, $page ) )156 157 if ( in_array( $page_obj->ID, $page ) ) 158 158 return true; 159 159 elseif ( in_array( $page_obj->post_title, $page ) ) 160 160 return true; … … 895 895 } 896 896 $n = ($q['exact']) ? '' : '%'; 897 897 $searchand = ''; 898 foreach( (array)$q['search_terms'] as $term) {898 foreach( (array) $q['search_terms'] as $term) { 899 899 $term = addslashes_gpc($term); 900 900 $search .= "{$searchand}((post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}'))"; 901 901 $searchand = ' AND '; … … 918 918 $q['cat'] = ''.urldecode($q['cat']).''; 919 919 $q['cat'] = addslashes_gpc($q['cat']); 920 920 $cat_array = preg_split('/[,\s]+/', $q['cat']); 921 foreach ( $cat_array as $cat ) {921 foreach ( (array) $cat_array as $cat ) { 922 922 $cat = intval($cat); 923 923 $in = ($cat > 0); 924 924 $cat = abs($cat); -
rewrite.php
140 140 global $wp; 141 141 parse_str($query, $query_vars); 142 142 $query = array(); 143 foreach ( $query_vars as $key => $value ) {143 foreach ( (array) $query_vars as $key => $value ) { 144 144 if ( in_array($key, $wp->public_query_vars) ) 145 145 $query[$key] = $value; 146 146 } … … 293 293 return array( array(), array() ); 294 294 295 295 296 foreach ( $posts as $id => $post) {296 foreach ( $posts as $id => $post) { 297 297 // URL => page name 298 298 $uri = get_page_uri($id); 299 299 $attachments = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $id )); … … 372 372 $front = $this->front; 373 373 preg_match_all('/%.+?%/', $this->permalink_structure, $tokens); 374 374 $tok_index = 1; 375 foreach ( $tokens[0] as $token) {375 foreach ( (array) $tokens[0] as $token) { 376 376 if ( ($token == '%post_id%') && ($tok_index <= 3) ) { 377 377 $front = $front . 'date/'; 378 378 break; … … 552 552 function generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) { 553 553 //build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/? 554 554 $feedregex2 = ''; 555 foreach ( $this->feeds as $feed_name) {555 foreach ( (array) $this->feeds as $feed_name) { 556 556 $feedregex2 .= $feed_name . '|'; 557 557 } 558 558 $feedregex2 = '(' . trim($feedregex2, '|') . ')/?$'; … … 567 567 //build up an array of endpoint regexes to append => queries to append 568 568 if ($endpoints) { 569 569 $ep_query_append = array (); 570 foreach ( $this->endpoints as $endpoint) {570 foreach ( (array) $this->endpoints as $endpoint) { 571 571 //match everything after the endpoint name, but allow for nothing to appear there 572 572 $epmatch = $endpoint[1] . '(/(.*))?/?$'; 573 573 //this will be appended on to the rest of the query for each dir … … 664 664 665 665 //do endpoints 666 666 if ($endpoints) { 667 foreach ( $ep_query_append as $regex => $ep) {667 foreach ( (array) $ep_query_append as $regex => $ep) { 668 668 //add the endpoints on if the mask fits 669 669 if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) { 670 670 $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2); … … 721 721 $subfeedquery = $subquery . '&feed=' . $this->preg_index(2); 722 722 723 723 //do endpoints for attachments 724 if ($endpoint) { foreach ( $ep_query_append as $regex => $ep) {724 if ($endpoint) { foreach ( (array) $ep_query_append as $regex => $ep) { 725 725 if ($ep[0] & EP_ATTACHMENT) { 726 726 $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); 727 727 $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2); … … 865 865 $rules .= "RewriteBase $home_root\n"; 866 866 867 867 //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all) 868 foreach ( $this->non_wp_rules as $match => $query) {868 foreach ( (array) $this->non_wp_rules as $match => $query) { 869 869 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 870 870 $match = str_replace('.+?', '.+', $match); 871 871 … … 886 886 "RewriteCond %{REQUEST_FILENAME} -d\n" . 887 887 "RewriteRule ^.*$ - [S=$num_rules]\n"; 888 888 889 foreach ( $rewrite as $match => $query) {889 foreach ( (array) $rewrite as $match => $query) { 890 890 // Apache 1.3 does not support the reluctant (non-greedy) modifier. 891 891 $match = str_replace('.+?', '.+', $match); 892 892 -
rss.php
2 2 do_action('load_feed_engine'); 3 3 4 4 /* 5 * Project: MagpieRSS: a simple RSS integration tool6 * File: A compiled file for RSS syndication7 * Author: Kellan Elliott-McCrea <kellan@protest.net>5 * Project: MagpieRSS: a simple RSS integration tool 6 * File: A compiled file for RSS syndication 7 * Author: Kellan Elliott-McCrea <kellan@protest.net> 8 8 * Version: 0.51 9 9 * License: GPL 10 10 */ … … 525 525 $rss = new MagpieRSS( $resp->results ); 526 526 527 527 // if RSS parsed successfully 528 if ( $rss and!$rss->ERROR) {528 if ( $rss && !$rss->ERROR) { 529 529 530 530 // find Etag, and Last-Modified 531 foreach( $resp->headers as $h) {531 foreach( (array) $resp->headers as $h) { 532 532 // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1" 533 533 if (strpos($h, ": ")) { 534 534 list($field, $val) = explode(": ", $h, 2); … … 833 833 $rss->items = array_slice( $rss->items, 0, $num_items ); 834 834 } 835 835 836 foreach ( $rss->items as $item ) {836 foreach ( (array) $rss->items as $item ) { 837 837 printf( 838 838 '<li><a href="%1$s" title="%2$s">%3$s</a></li>', 839 839 clean_url( $item['link'] ), … … 854 854 $rss = fetch_rss($url); 855 855 if ( $rss ) { 856 856 $rss->items = array_slice($rss->items, 0, $num_items); 857 foreach ( $rss->items as $item ) {857 foreach ( (array) $rss->items as $item ) { 858 858 echo "<li>\n"; 859 859 echo "<a href='$item[link]' title='$item[description]'>"; 860 860 echo htmlentities($item['title']); -
script-loader.php
164 164 165 165 $to_print = apply_filters( 'print_scripts_array', array_keys($this->to_print) ); 166 166 167 foreach( $to_print as $handle ) {167 foreach( (array) $to_print as $handle ) { 168 168 if ( !in_array($handle, $this->printed) && isset($this->scripts[$handle]) ) { 169 169 if ( $this->scripts[$handle]->src ) { // Else it defines a group. 170 170 $ver = $this->scripts[$handle]->ver ? $this->scripts[$handle]->ver : $wp_db_version; … … 200 200 echo "/* <![CDATA[ */\n"; 201 201 echo "\t$object_name = {\n"; 202 202 $eol = ''; 203 foreach ( $this->scripts[$handle]->l10n as $var => $val ) {203 foreach ( (array) $this->scripts[$handle]->l10n as $var => $val ) { 204 204 echo "$eol\t\t$var: \"" . js_escape( $val ) . '"'; 205 205 $eol = ",\n"; 206 206 } … … 218 218 * @param bool recursion Used internally when function calls itself 219 219 */ 220 220 function all_deps( $handles, $recursion = false ) { 221 if ( ! $handles = (array) $handles)221 if ( !is_array($handles) ) 222 222 return false; 223 223 224 224 foreach ( $handles as $handle ) { -
taxonomy.php
41 41 global $wp_taxonomies; 42 42 43 43 $taxonomies = array(); 44 foreach ( $wp_taxonomies as $taxonomy ) {44 foreach ( (array) $wp_taxonomies as $taxonomy ) { 45 45 if ( $object_type === $taxonomy->object_type ) 46 46 $taxonomies[] = $taxonomy->name; 47 47 } … … 195 195 if ( !is_array($taxonomies) ) 196 196 $taxonomies = array($taxonomies); 197 197 198 foreach ( $taxonomies as $taxonomy ) {198 foreach ( (array) $taxonomies as $taxonomy ) { 199 199 if ( ! is_taxonomy($taxonomy) ) 200 200 return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); 201 201 } … … 386 386 387 387 $children = $terms[$term]; 388 388 389 foreach ( $terms[$term] as $child ) {389 foreach ( (array) $terms[$term] as $child ) { 390 390 if ( isset($terms[$child]) ) 391 391 $children = array_merge($children, get_term_children($child, $taxonomy)); 392 392 } … … 513 513 $taxonomies = array($taxonomies); 514 514 } 515 515 516 foreach ( $taxonomies as $taxonomy ) {516 foreach ( (array) $taxonomies as $taxonomy ) { 517 517 if ( ! is_taxonomy($taxonomy) ) 518 518 return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); 519 519 } … … 577 577 $exclude = ''; 578 578 $interms = preg_split('/[\s,]+/',$include); 579 579 if ( count($interms) ) { 580 foreach ( $interms as $interm ) {580 foreach ( (array) $interms as $interm ) { 581 581 if (empty($inclusions)) 582 582 $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' '; 583 583 else … … 594 594 if ( !empty($exclude) ) { 595 595 $exterms = preg_split('/[\s,]+/',$exclude); 596 596 if ( count($exterms) ) { 597 foreach ( $exterms as $exterm ) {597 foreach ( (array) $exterms as $exterm ) { 598 598 if (empty($exclusions)) 599 599 $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' '; 600 600 else … … 662 662 _pad_term_counts($terms, $taxonomies[0]); 663 663 664 664 // Make sure we show empty categories that have children. 665 if ( $hierarchical && $hide_empty ) {665 if ( $hierarchical && $hide_empty && is_array($terms) ) { 666 666 foreach ( $terms as $k => $term ) { 667 667 if ( ! $term->count ) { 668 668 $children = _get_term_children($term->term_id, $terms, $taxonomies[0]); 669 foreach ( $children as $child ) 670 if ( $child->count ) 671 continue 2; 669 if( is_array($children) ) 670 foreach ( $children as $child ) 671 if ( $child->count ) 672 continue 2; 672 673 673 674 // It really is empty 674 675 unset($terms[$k]); … … 749 750 if ( is_object($term) ) 750 751 $do_object = true; 751 752 752 foreach ( $fields as $field ) {753 foreach ( (array) $fields as $field ) { 753 754 if ( $do_object ) 754 755 $term->$field = sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context); 755 756 else … … 876 877 if ( !is_array($taxonomies) ) 877 878 $taxonomies = array($taxonomies); 878 879 879 foreach ( $taxonomies as $taxonomy ) {880 foreach ( (array) $taxonomies as $taxonomy ) { 880 881 $terms = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids'); 881 882 $in_terms = "'" . implode("', '", $terms) . "'"; 882 883 $wpdb->query("DELETE FROM $wpdb->term_relationships WHERE object_id = '$object_id' AND term_taxonomy_id IN ($in_terms)"); … … 1001 1002 if ( !is_array($taxonomies) ) 1002 1003 $taxonomies = array($taxonomies); 1003 1004 1004 foreach ( $taxonomies as $taxonomy ) {1005 foreach ( (array) $taxonomies as $taxonomy ) { 1005 1006 if ( ! is_taxonomy($taxonomy) ) 1006 1007 return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy')); 1007 1008 } … … 1204 1205 $tt_ids = array(); 1205 1206 $term_ids = array(); 1206 1207 1207 foreach ( $terms as $term) {1208 foreach ( (array) $terms as $term) { 1208 1209 if ( !strlen(trim($term)) ) 1209 1210 continue; 1210 1211 … … 1446 1447 static $_deferred = array(); 1447 1448 1448 1449 if ( $do_deferred ) { 1449 foreach ( array_keys($_deferred) as $tax ) {1450 foreach ( (array) array_keys($_deferred) as $tax ) { 1450 1451 wp_update_term_count_now( $_deferred[$tax], $tax ); 1451 1452 unset( $_deferred[$tax] ); 1452 1453 } … … 1478 1479 call_user_func($taxonomy->update_count_callback, $terms); 1479 1480 } else { 1480 1481 // Default count updater 1481 foreach ( $terms as $term) {1482 foreach ( (array) $terms as $term) { 1482 1483 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) ); 1483 1484 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); 1484 1485 } … … 1665 1666 * @param string $taxonomy Optional. Update Term to this taxonomy in cache 1666 1667 */ 1667 1668 function update_term_cache($terms, $taxonomy = '') { 1668 foreach ( $terms as $term ) {1669 foreach ( (array) $terms as $term ) { 1669 1670 $term_taxonomy = $taxonomy; 1670 1671 if ( empty($term_taxonomy) ) 1671 1672 $term_taxonomy = $term->taxonomy; … … 1736 1737 if ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) ) 1737 1738 return array(); 1738 1739 1739 foreach ( $terms as $term ) {1740 foreach ( (array) $terms as $term ) { 1740 1741 $use_id = false; 1741 1742 if ( !is_object($term) ) { 1742 1743 $term = get_term($term, $taxonomy); … … 1795 1796 1796 1797 $term_items = array(); 1797 1798 1798 foreach ( $terms as $key => $term ) {1799 foreach ( (array) $terms as $key => $term ) { 1799 1800 $terms_by_id[$term->term_id] = & $terms[$key]; 1800 1801 $term_ids[$term->term_taxonomy_id] = $term->term_id; 1801 1802 } … … 1844 1845 function _update_post_term_count( $terms ) { 1845 1846 global $wpdb; 1846 1847 1847 foreach ( $terms as $term ) {1848 foreach ( (array) $terms as $term ) { 1848 1849 $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term ) ); 1849 1850 $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) ); 1850 1851 } -
user.php
101 101 return ''; 102 102 } 103 103 104 foreach ( $metas as $meta)104 foreach ( (array) $metas as $meta) 105 105 $values[] = maybe_unserialize($meta->meta_value); 106 106 107 107 if ( count($values) == 1 ) … … 216 216 if ( $show_option_none ) 217 217 $output .= "\t<option value='-1'>$show_option_none</option>\n"; 218 218 219 foreach ( $users as $user ) {219 foreach ( (array) $users as $user ) { 220 220 $user->ID = (int) $user->ID; 221 221 $_selected = $user->ID == $selected ? " selected='selected'" : ''; 222 222 $output .= "\t<option value='$user->ID'$_selected>" . wp_specialchars($user->$show) . "</option>\n"; … … 241 241 $wpdb->show_errors($show); 242 242 243 243 if ( $metavalues ) { 244 foreach ( $metavalues as $meta ) {244 foreach ( (array) $metavalues as $meta ) { 245 245 $value = maybe_unserialize($meta->meta_value); 246 246 $user->{$meta->meta_key} = $value; 247 247 } -
widgets.php
204 204 $index = "sidebar-$index"; 205 205 } else { 206 206 $index = sanitize_title($index); 207 foreach ( $wp_registered_sidebars as $key => $value ) {207 foreach ( (array) $wp_registered_sidebars as $key => $value ) { 208 208 if ( sanitize_title($value['name']) == $index ) { 209 209 $index = $key; 210 210 break; … … 220 220 $sidebar = $wp_registered_sidebars[$index]; 221 221 222 222 $did_one = false; 223 foreach ( $sidebars_widgets[$index] as $id ) {223 foreach ( (array) $sidebars_widgets[$index] as $id ) { 224 224 $callback = $wp_registered_widgets[$id]['callback']; 225 225 226 226 $params = array_merge(array($sidebar), (array) $wp_registered_widgets[$id]['params']); … … 263 263 function is_dynamic_sidebar() { 264 264 global $wp_registered_widgets, $wp_registered_sidebars; 265 265 $sidebars_widgets = get_option('sidebars_widgets'); 266 foreach ( $wp_registered_sidebars as $index => $sidebar ) {266 foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) { 267 267 if ( count($sidebars_widgets[$index]) ) { 268 foreach ( $sidebars_widgets[$index] as $widget )268 foreach ( (array) $sidebars_widgets[$index] as $widget ) 269 269 if ( array_key_exists($widget, $wp_registered_widgets) ) 270 270 return true; 271 271 } … … 286 286 287 287 switch ( $sidebars_widgets['array_version'] ) { 288 288 case 1 : 289 foreach ( $sidebars_widgets as $index => $sidebar )289 foreach ( (array) $sidebars_widgets as $index => $sidebar ) 290 290 if ( is_array($sidebar) ) 291 foreach ( $sidebar as $i => $name ) {291 foreach ( (array) $sidebar as $i => $name ) { 292 292 $id = strtolower($name); 293 293 if ( isset($wp_registered_widgets[$id]) ) { 294 294 $_sidebars_widgets[$index][$i] = $id; … … 309 309 $sidebars = array_keys( $wp_registered_sidebars ); 310 310 if ( !empty( $sidebars ) ) { 311 311 // Move the known-good ones first 312 foreach ( $sidebars as $id ) {312 foreach ( (array) $sidebars as $id ) { 313 313 if ( array_key_exists( $id, $sidebars_widgets ) ) { 314 314 $_sidebars_widgets[$id] = $sidebars_widgets[$id]; 315 315 unset($sidebars_widgets[$id], $sidebars[$id]); … … 344 344 345 345 $defaults = array(); 346 346 347 foreach ( $wp_registered_sidebars as $index => $sidebar )347 foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) 348 348 $defaults[$index] = array(); 349 349 350 350 return $defaults; … … 598 598 else 599 599 $this_sidebar = array(); 600 600 601 foreach ( $this_sidebar as $_widget_id ) {601 foreach ( (array) $this_sidebar as $_widget_id ) { 602 602 if ( 'wp_widget_text' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 603 603 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; 604 604 unset($options[$widget_number]); … … 648 648 wp_register_widget_control( 'text-1', $name, 'wp_widget_text_control', $control_ops, array( 'number' => -1 ) ); 649 649 } 650 650 651 foreach ( array_keys($options) as $o ) {651 foreach ( (array) array_keys($options) as $o ) { 652 652 // Old widgets can have null values for some reason 653 653 if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) ) 654 654 continue; … … 687 687 688 688 <script type='text/javascript'> 689 689 /* <![CDATA[ */ 690 var dropdown = document.getElementById("cat");691 function onCatChange() {690 var dropdown = document.getElementById("cat"); 691 function onCatChange() { 692 692 if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { 693 693 location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value; 694 694 } 695 }696 dropdown.onchange = onCatChange;695 } 696 dropdown.onchange = onCatChange; 697 697 /* ]]> */ 698 698 </script> 699 699 … … 732 732 else 733 733 $this_sidebar = array(); 734 734 735 foreach ( $this_sidebar as $_widget_id ) {735 foreach ( (array) $this_sidebar as $_widget_id ) { 736 736 if ( 'wp_widget_categories' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 737 737 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; 738 738 unset($options[$widget_number]); 739 } 739 } 740 740 } 741 741 742 742 foreach ( (array) $_POST['widget-categories'] as $widget_number => $widget_cat ) { … … 809 809 wp_register_widget_control( 'categories-1', $name, 'wp_widget_categories_control', array( 'id_base' => 'categories' ), array( 'number' => -1 ) ); 810 810 } 811 811 812 foreach ( array_keys($options) as $o ) {812 foreach ( (array) array_keys($options) as $o ) { 813 813 // Old widgets can have null values for some reason 814 814 if ( !isset($options[$o]['title']) ) 815 815 continue; … … 932 932 <?php echo $before_widget; ?> 933 933 <?php echo $before_title . $title . $after_title; ?> 934 934 <ul id="recentcomments"><?php 935 if ( $comments ) : foreach ( $comments as $comment) :935 if ( $comments ) : foreach ( (array) $comments as $comment) : 936 936 echo '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>'; 937 937 endforeach; endif;?></ul> 938 938 <?php echo $after_widget; ?> … … 1037 1037 if ( is_array( $rss->items ) && !empty( $rss->items ) ) { 1038 1038 $rss->items = array_slice($rss->items, 0, $num_items); 1039 1039 echo '<ul>'; 1040 foreach ( $rss->items as $item ) {1040 foreach ( (array) $rss->items as $item ) { 1041 1041 while ( strstr($item['link'], 'http') != $item['link'] ) 1042 1042 $item['link'] = substr($item['link'], 1); 1043 1043 $link = clean_url(strip_tags($item['link'])); … … 1076 1076 $options = array(); 1077 1077 1078 1078 $urls = array(); 1079 foreach ( $options as $option )1079 foreach ( (array) $options as $option ) 1080 1080 if ( isset($option['url']) ) 1081 1081 $urls[$option['url']] = true; 1082 1082 … … 1089 1089 else 1090 1090 $this_sidebar = array(); 1091 1091 1092 foreach ( $this_sidebar as $_widget_id ) {1092 foreach ( (array) $this_sidebar as $_widget_id ) { 1093 1093 if ( 'wp_widget_rss' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) { 1094 1094 $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number']; 1095 1095 unset($options[$widget_number]); … … 1172 1172 wp_register_widget_control( 'rss-1', $name, 'wp_widget_rss_control', $control_ops, array( 'number' => -1 ) ); 1173 1173 } 1174 1174 1175 foreach ( array_keys($options) as $o ) {1175 foreach ( (array) array_keys($options) as $o ) { 1176 1176 // Old widgets can have null values for some reason 1177 1177 if ( !isset($options[$o]['url']) || !isset($options[$o]['title']) || !isset($options[$o]['items']) ) 1178 1178 contine; -
wp-db.php
99 99 $old_prefix = $this->prefix; 100 100 $this->prefix = $prefix; 101 101 102 foreach ( $this->tables as $table )102 foreach ( (array) $this->tables as $table ) 103 103 $this->$table = $this->prefix . $table; 104 104 105 105 if ( defined('CUSTOM_USER_TABLE') ) … … 315 315 function update($table, $data, $where){ 316 316 $data = add_magic_quotes($data); 317 317 $bits = $wheres = array(); 318 foreach ( array_keys($data) as $k )318 foreach ( (array) array_keys($data) as $k ) 319 319 $bits[] = "`$k` = '$data[$k]'"; 320 320 321 321 if ( is_array( $where ) ) … … 413 413 } elseif ( $output == ARRAY_A || $output == ARRAY_N ) { 414 414 if ( $this->last_result ) { 415 415 $i = 0; 416 foreach( $this->last_result as $row ) {416 foreach( (array) $this->last_result as $row ) { 417 417 $new_array[$i] = (array) $row; 418 418 if ( $output == ARRAY_N ) { 419 419 $new_array[$i] = array_values($new_array[$i]); … … 437 437 if ( $this->col_info ) { 438 438 if ( $col_offset == -1 ) { 439 439 $i = 0; 440 foreach( $this->col_info as $col ) {440 foreach( (array) $this->col_info as $col ) { 441 441 $new_array[$i] = $col->{$info_type}; 442 442 $i++; 443 443 } … … 519 519 $bt = debug_backtrace(); 520 520 $caller = ''; 521 521 522 foreach ( $bt as $trace ) {522 foreach ( (array) $bt as $trace ) { 523 523 if ( @$trace['class'] == __CLASS__ ) 524 524 continue; 525 525 elseif ( strtolower(@$trace['function']) == 'call_user_func_array' )