[wp-trac] [WordPress Trac] #37223: Fatal error when adding a new multi-site user due to incorrect error handling.

WordPress Trac noreply at wordpress.org
Wed Jun 29 10:56:36 UTC 2016


#37223: Fatal error when adding a new multi-site user due to incorrect error
handling.
--------------------------+-----------------------------
 Reporter:  pbogdan       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  4.5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Hello,

 we are seeing the following fatal error when adding a new user on multi-
 site installation:

 {{{
 PHP Fatal error:  Cannot use object of type WP_Error as array in wp-admin
 /user-new.php on line 154
 }}}

 due to a change introduced in ticket #35705 / changeset r36695. This
 appears to be due to the branches of the conditional on line 151 being in
 the wrong order - the second branch that will be taken if `$new_user` is a
 WP_Error tries to treat it as an array containing user's details.

 In our specific case the call to `wpmu_activate_signup()` is returning a
 WP_Error as we call that ourselves earlier on when a user is added, and
 the second invocation will return an error in that case.

 Apart from fixing the conditional it might be worth checking, if possible,
 whether the user has already been activated either before the call to
 `wpmu_activate_signup()` or by somehow inspecting the returned error.

 Thanks,
 Piotr

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


More information about the wp-trac mailing list