Opened 19 years ago
Closed 19 years ago
#1467 closed defect (bug) (fixed)
foreach( $metavalues ) in pluggable-functions.php causes PHP warnings
Reported by: | davidhouse | Owned by: | davidhouse |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 1.6 |
Component: | Administration | Keywords: | bg|has-patch bg|squashed |
Focuses: | Cc: |
Description
wp-includes/pluggable-functions.php:42 has a foreach() statement that loops over a user's meta. However, this gives warnings when creating a new user and when promoting a user from level 0 level 1. If you have PHP's ini setting display_errors set to 'on', it even causes a crash when promoting a user into an author as the header() call fails.
Patch:
--- ../xmouse/wp-includes/pluggable-functions.php 2005-06-19 09:33:44.000000000 +0100 +++ wp-includes/pluggable-functions.php 2005-06-24 09:45:27.270279048 +0100 @@ -39,8 +39,10 @@ $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;
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
added 1467.patch to reflect current state of pluggable-functions.php in 1.6.