[wp-trac] [WordPress Trac] #28315: update_user_meta() updates user with ID1 if WP_Error is passed as first argument

WordPress Trac noreply at wordpress.org
Tue May 20 16:03:27 UTC 2014


#28315: update_user_meta() updates user with ID1 if WP_Error is passed as first
argument
--------------------------------+-----------------------------
 Reporter:  javorszky           |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  3.9.1
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 {{{
 // Let $existing details be an array with an email address that's already
 in there
 $id = wp_insert_user( $existing_details );

 // At this point, because $id _SHOULD_ be an instance of WP_Error (which
 it is btw),
 // telling me a user with that email address or username already exists.
 // You kinda hope this would fail or have no effect whatsoever.
 update_user_meta( $id, 'key', 'value' );

 // Now go forth and check user #1's user meta tables...
 }}}

 Problem is with `meta.php:136`, function `update_metadata`.

 This:
 {{{
 if ( !$object_id = absint($object_id) )
         return false;
 }}}
 should be
 {{{
 if ( $object_id != absint($object_id) )
         return false;
 }}}

 (Tested locally, worked)

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28315>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list