[BUGFIX] Check if validationrules are set before foreach statement 46/38846/2
authorRuud <ruudsilvrants@gmail.com>
Tue, 21 Apr 2015 09:21:47 +0000 (11:21 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 21 Apr 2015 10:10:17 +0000 (12:10 +0200)
The ValidationUtility now checks if there are any rules set,
before trying to use the variable in the foreach loop.

Resolves: #66508
Releases: master, 6.2
Change-Id: I201986d88666d8de8a84de6581d2ea06da7374c2
Reviewed-on: http://review.typo3.org/38846
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/form/Classes/Utility/ValidatorUtility.php

index 5b7a7cd..ca5f695 100644 (file)
@@ -116,7 +116,7 @@ class ValidatorUtility implements \TYPO3\CMS\Core\SingletonInterface {
                $this->errors[$prefix] = array();
                $result = TRUE;
                if (is_array($this->rules[$prefix])) {
-                               foreach ($this->rules[$prefix] as $key => $element) {
+                       foreach ($this->rules[$prefix] as $key => $element) {
                                /* @var $rule AbstractValidator */
                                $rule = $element['instance'];
                                $fieldName = $element['fieldName'];