Some foreach array casting

git-svn-id: http://svn.automattic.com/wordpress/trunk@6242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-10-13 05:33:39 +00:00
parent 6f0cbc16a8
commit 4a43a0b353

View File

@ -1666,7 +1666,7 @@ function update_postmeta_cache($post_ids) {
return false; return false;
$ids = array(); $ids = array();
foreach ( $post_ids as $id ) { foreach ( (array) $post_ids as $id ) {
if ( false === wp_cache_get($id, 'post_meta') ) if ( false === wp_cache_get($id, 'post_meta') )
$ids[] = $id; $ids[] = $id;
} }
@ -1678,7 +1678,7 @@ function update_postmeta_cache($post_ids) {
$id_list = join(',', $ids); $id_list = join(',', $ids);
$cache = array(); $cache = array();
if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN ($id_list) ORDER BY post_id, meta_key", ARRAY_A) ) { if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN ($id_list) ORDER BY post_id, meta_key", ARRAY_A) ) {
foreach ($meta_list as $metarow) { foreach ( (array) $meta_list as $metarow) {
$mpid = (int) $metarow['post_id']; $mpid = (int) $metarow['post_id'];
$mkey = $metarow['meta_key']; $mkey = $metarow['meta_key'];
$mval = $metarow['meta_value']; $mval = $metarow['meta_value'];
@ -1694,7 +1694,7 @@ function update_postmeta_cache($post_ids) {
} }
} }
foreach ( $ids as $id ) { foreach ( (array) $ids as $id ) {
if ( ! isset($cache[$id]) ) if ( ! isset($cache[$id]) )
$cache[$id] = array(); $cache[$id] = array();
} }