Opened 21 years ago
Closed 21 years ago
#1441 closed defect (bug) (invalid)
foreach() warning if no post meta
| Reported by: | davidhouse | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Administration | Version: | 1.5.2 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
(latest svn)
If you haven't attached any custom fields to a post, you get a warning at the top of every screen:
Warning: Invalid argument supplied for foreach() in /srv/htdocs/wp/wp-includes/functions.php on line 1172
Patch:
--- functions.php 2005-06-14 13:16:26.887806504 +0100
+++ functions-mod.php 2005-06-14 13:23:04.870303968 +0100
@@ -1169,8 +1169,10 @@
foreach ($users as $user) :
$metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user->ID'");
- foreach ( $metavalues as $meta )
- $user->{$meta->meta_key} = $meta->meta_value;
+ if ($metavalues) {
+ foreach ( $metavalues as $meta )
+ $user->{$meta->meta_key} = $meta->meta_value;
+ }
$cache_userdata[$user->ID] = $user;
$cache_userdata[$user->user_login] =& $cache_userdata[$user->ID];
endforeach;
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Apologies, I was getting post meta confused with user meta. Ran upgrade.php and everything's finished.