Merge "Use {{int:}} on MediaWiki:Blockedtext and MediaWiki:Autoblockedtext"
[lhc/web/wiklou.git] / includes / password / MWSaltedPassword.php
index 6c6895a..733984c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Implements the BcryptPassword class for the MediaWiki software.
+ * Implements the MWSaltedPassword class for the MediaWiki software.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
  */
 class MWSaltedPassword extends ParameterizedPassword {
        protected function getDefaultParams() {
-               return array();
+               return [];
        }
 
        protected function getDelimiter() {
@@ -42,5 +42,9 @@ class MWSaltedPassword extends ParameterizedPassword {
                }
 
                $this->hash = md5( $this->args[0] . '-' . md5( $plaintext ) );
+
+               if ( !is_string( $this->hash ) || strlen( $this->hash ) < 32 ) {
+                       throw new PasswordError( 'Error when hashing password.' );
+               }
        }
 }