Fix handling of error messages from the 'SpecialPasswordResetOnSubmit' hook
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 16 Jun 2016 16:03:59 +0000 (12:03 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 16 Jun 2016 16:03:59 +0000 (12:03 -0400)
$error might be an array of key + values, but wfMessage() treats that as
an array of alternative message keys instead so the values are lost.
Message::newFromSpecifier(), on the other hand, does exactly what we
want.

Change-Id: I25765869f6888ac793c2af9caaa9bbdf2224d51a

includes/user/PasswordReset.php

index 60144bb..bc87cd0 100644 (file)
@@ -153,7 +153,7 @@ class PasswordReset {
                        'Capture' => $displayPassword ? '1' : null,
                ];
                if ( !Hooks::run( 'SpecialPasswordResetOnSubmit', [ &$users, $data, &$error ] ) ) {
-                       return StatusValue::newFatal( wfMessage( $error ) );
+                       return StatusValue::newFatal( Message::newFromSpecifier( $error ) );
                }
 
                if ( !$users ) {