From d31bdfe64ebc5781b9932fc9e676e32969526cb5 Mon Sep 17 00:00:00 2001
From: Ralf Zimmermann <ralf.zimmermann@tritum.de>
Date: Sat, 25 Mar 2017 17:47:35 +0100
Subject: [PATCH] [BUGFIX] EXT:form - avoid php warnings

Avoid php warnings if no individual validation errors are defined.

Resolves: #80439
Releases: master
Change-Id: Idc3f566eb922afe3fc167d5738da54c09f78f83e
Reviewed-on: https://review.typo3.org/52152
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Patrick Broens <patrick@patrickbroens.nl>
Tested-by: Patrick Broens <patrick@patrickbroens.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/form/Classes/Service/TranslationService.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/form/Classes/Service/TranslationService.php b/typo3/sysext/form/Classes/Service/TranslationService.php
index e1da16ad45ab..397313cae2ec 100644
--- a/typo3/sysext/form/Classes/Service/TranslationService.php
+++ b/typo3/sysext/form/Classes/Service/TranslationService.php
@@ -398,9 +398,11 @@ class TranslationService implements SingletonInterface
         }
 
         $validationErrors = $element->getProperties()['validationErrorMessages'];
-        foreach ($validationErrors as $validationError) {
-            if ((int)$validationError['code'] === $code) {
-                return sprintf($validationError['message'], $arguments);
+        if (is_array($validationErrors)) {
+            foreach ($validationErrors as $validationError) {
+                if ((int)$validationError['code'] === $code) {
+                    return sprintf($validationError['message'], $arguments);
+                }
             }
         }
 
-- 
GitLab