[BUGFIX] EXT:form - avoid php warnings 52/52152/2
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Sat, 25 Mar 2017 16:47:35 +0000 (17:47 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 25 Mar 2017 22:11:44 +0000 (23:11 +0100)
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

index e1da16a..397313c 100644 (file)
@@ -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);
+                }
             }
         }