Merge "Make JobQueueRedis stat calls match the DB one"
[lhc/web/wiklou.git] / includes / User.php
index 0dfdfc4..6e52a1d 100644 (file)
@@ -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();