[wp-trac] [WordPress Trac] #16731: Unchecked array_merge() returns NULL in wp_update_user();
WordPress Trac
noreply at wordpress.org
Thu Nov 15 11:46:10 UTC 2012
#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: has-patch |
--------------------------+------------------------------
Changes (by karacsi_maci):
* cc: karacsi_maci (added)
Comment:
This problem still not solved (after 21 month?)
{{{
$userdata = array(
'ID' => get_current_user_id(),
'first_name' => $this->postVars['firstName'],
'last_name' => $this->postVars['lastName']);
if (!empty($this->postVars['pass'])) {
$userdata['user_pass'] = $this->postVars['pass'];
}
wp_update_user($userdata);
}}}
(The $this->postVars exactly the same as $_POST, don't care about it).
If you just comment out the ID line, you will get the get_object_vars
error.
So codex lies:
"If $userdata does not contain an 'ID' key, then a new user will be
created and the new user's ID will be returned."
(There are first name and last name in my array). So you should rewrite
the codex, to tell to users that, they SHOULD use a loginname at least.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16731#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list