Fix PHP warning when using createaccount API

Change-Id: I5975c34be4fc11af8dcdd394c0c6605e72f13582
This commit is contained in:
Gergő Tisza 2016-04-26 22:22:55 +02:00
parent 6acac228d9
commit 5cf1769f46

View file

@ -1150,7 +1150,8 @@ class SimpleCaptcha {
// If we failed a captcha, override the generic 'Warning' result string
if ( $result['result'] === 'Warning' && isset( $result['warnings'] ) ) {
foreach ( $result['warnings'] as $warning ) {
$warnings = ApiResult::stripMetadataNonRecursive( $result['warnings'] );
foreach ( $warnings as $warning ) {
if ( $warning['message'] === 'captcha-createaccount-fail' ) {
$this->addCaptchaAPI( $result );
$result['result'] = 'NeedCaptcha';
@ -1161,6 +1162,8 @@ class SimpleCaptcha {
'event' => 'captcha.display',
'type' => 'accountcreation',
) );
break;
}
}
}