LoggerFactory: Only check for Psr\Log\LoggerInterface once
[lhc/web/wiklou.git] / includes / User.php
index 5bf6f44..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();
@@ -5246,7 +5251,7 @@ class User implements IDBAccessObject {
 
                # Note that the pattern requirement will always be satisfied if the
                # input is empty, so we need required in all cases.
-               #
+
                # @todo FIXME: Bug 23769: This needs to not claim the password is required
                # if e-mail confirmation is being used.  Since HTML5 input validation
                # is b0rked anyway in some browsers, just return nothing.  When it's