[FEATURE] Multiple params for user function in typoscript conditions. 35/19835/3
authorDaniel Hürtgen <huertgen@rheinschafe.de>
Fri, 12 Apr 2013 12:35:47 +0000 (14:35 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 26 May 2013 15:06:15 +0000 (17:06 +0200)
Currrently you can use user functions for typoscript conditions and
pass one parameter to your created functions. If you have more than
parameter, you must create a workaround and use an delimiter other
than comma an split it up in your user functions to separate them.

This patch is a fix for that and make it possible to use multiple params
for user functions.

Change-Id: Ief2486f6133132303a5925370c1517ee9a98a0b4
Resolves: #47159
Releases: 6.2
Reviewed-on: https://review.typo3.org/19835
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
Reviewed-by: Daniel Hürtgen
Tested-by: Daniel Hürtgen
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php

index 05861b0..a1b4622 100644 (file)
@@ -405,8 +405,8 @@ abstract class AbstractConditionMatcher {
                case 'userFunc':
                        $values = preg_split('/\\(|\\)/', $value);
                        $funcName = trim($values[0]);
-                       $funcValue = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $values[1]);
-                       if (function_exists($funcName) && call_user_func($funcName, $funcValue[0])) {
+                       $funcValues = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $values[1]);
+                       if (function_exists($funcName) && call_user_func_array($funcName, $funcValues)) {
                                return TRUE;
                        }
                        break;
@@ -666,4 +666,4 @@ abstract class AbstractConditionMatcher {
 }
 
 
-?>
\ No newline at end of file
+?>