From 5cf1769f467d5f8e5a720e9d1bb5b42e2a0a30f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Tisza?= Date: Tue, 26 Apr 2016 22:22:55 +0200 Subject: [PATCH] Fix PHP warning when using createaccount API Change-Id: I5975c34be4fc11af8dcdd394c0c6605e72f13582 --- SimpleCaptcha/Captcha.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SimpleCaptcha/Captcha.php b/SimpleCaptcha/Captcha.php index 7697ab75b..4f010afd0 100755 --- a/SimpleCaptcha/Captcha.php +++ b/SimpleCaptcha/Captcha.php @@ -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; } } }