[wp-trac] [WordPress Trac] #16731: Unchecked array_merge() returns NULL in wp_update_user();

WordPress Trac wp-trac at lists.automattic.com
Sat Mar 12 15:41:51 UTC 2011


#16731: Unchecked array_merge() returns NULL in wp_update_user();
-------------------------------------------+------------------------------
 Reporter:  milan.chotai                   |       Owner:
     Type:  defect (bug)                   |      Status:  new
 Priority:  normal                         |   Milestone:  Awaiting Review
Component:  Users                          |     Version:  3.1
 Severity:  normal                         |  Resolution:
 Keywords:  2nd-opinion reporter-feedback  |
-------------------------------------------+------------------------------

Comment (by adambackstrom):

 Here's some code that generates these errors:

 {{{
 function test_wp_update_user() {
         $userdata = array(
                 'user_login' => 'user' . md5( microtime(true) ),
                 'user_pass' => 'foo',
         );

         var_dump( wp_update_user( $userdata ) );
 }
 }}}

 And the output:

 {{{

 Notice: Undefined index: ID in /web/wp-trunk/wp-includes/user.php on line
 1546

 Warning: get_object_vars() expects parameter 1 to be object, boolean given
 in /web/wp-trunk/wp-includes/user.php on line 1552

 Warning: array_merge(): Argument #1 is not an array in /web/wp-trunk/wp-
 includes/user.php on line 1563

 Warning: extract() expects parameter 1 to be array, null given in /web/wp-
 trunk/wp-includes/user.php on line 1385

 Notice: Undefined variable: user_pass in /web/wp-trunk/wp-
 includes/user.php on line 1395

 Notice: Undefined variable: user_login in /web/wp-trunk/wp-
 includes/user.php on line 1398
 object(WP_Error)#184 (2) {
   ["errors"]=>
   array(1) {
     ["empty_user_login"]=>
     array(1) {
       [0]=>
       string(46) "Cannot create a user with an empty login name."
     }
   }
   ["error_data"]=>
   array(0) {
   }
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16731#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list