From: Bryan Davis Date: Tue, 20 Oct 2015 15:49:01 +0000 (-0600) Subject: Fix undefined variable in User::setNewpassword X-Git-Tag: 1.31.0-rc.0~9333^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/supprimer.php?a=commitdiff_plain;h=aec040c70969258e4f08394a786cbd9224f36796;p=lhc%2Fweb%2Fwiklou.git Fix undefined variable in User::setNewpassword Follow up to I2c736ad to fix use of undefined `$id` variable. Change-Id: I04bd9c1dd7e3e1e63b8008d02df91cfb1ad971a3 --- diff --git a/includes/User.php b/includes/User.php index 0dfdfc4c14..6e52a1d980 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2478,6 +2478,11 @@ class User implements IDBAccessObject { * @param bool $throttle If true, reset the throttle timestamp to the present */ public function setNewpassword( $str, $throttle = true ) { + $id = $this->getId(); + if ( $id == 0 ) { + throw new LogicException( 'Cannot set new password for a user that is not in the database.' ); + } + $dbw = wfGetDB( DB_MASTER ); $passwordFactory = new PasswordFactory();