[FOLLOWUP][BUGFIX] DataHandler: Cache TCA field eval array 37/37937/4
authorNicole Cordes <typo3@cordes.co>
Wed, 18 Mar 2015 21:43:32 +0000 (22:43 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 18 Mar 2015 23:24:45 +0000 (00:24 +0100)
This fixes failing functional tests.

Resolves: #63670
Releases: master
Change-Id: Ief6ec0d6a1d2f45a7b8cb512741af722807aad9d
Reviewed-on: http://review.typo3.org/37937
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 7ce751e..da5486a 100644 (file)
@@ -670,13 +670,6 @@ class DataHandler {
        protected $runtimeCache = NULL;
 
        /**
-        * Prefix for the cache entries of 'eval'-strings from table fields since the runtimeCache has a global scope.
-        *
-        * @var string
-        */
-       protected $cachePrefixFieldEval = 'core-datahandler-eval-';
-
-       /**
         * Prefix for the cache entries of nested element calls since the runtimeCache has a global scope.
         *
         * @var string
@@ -1652,7 +1645,7 @@ class DataHandler {
                if (!isset($tcaFieldConf['eval']) || $tcaFieldConf['eval'] === '') {
                        return array('value' => $value);
                }
-               $cacheId = $this->cachePrefixFieldEval . $tcaFieldConf['eval'];
+               $cacheId = $this->getFieldEvalCacheIdentifier($tcaFieldConf['eval']);
                if ($this->runtimeCache->has($cacheId)) {
                        $evalCodesArray = $this->runtimeCache->get($cacheId);
                } else {
@@ -1705,7 +1698,7 @@ class DataHandler {
                        $res = array('value' => $value);
                } else {
                        // Process evaluation settings:
-                       $cacheId = $this->cachePrefixFieldEval . $tcaFieldConf['eval'];
+                       $cacheId = $this->getFieldEvalCacheIdentifier($tcaFieldConf['eval']);
                        if ($this->runtimeCache->has($cacheId)) {
                                $evalCodesArray = $this->runtimeCache->get($cacheId);
                        } else {
@@ -7524,6 +7517,16 @@ class DataHandler {
        }
 
        /**
+        * Return the cache entry identifier for field evals
+        *
+        * @param string $additionalIdentifier
+        * @return string
+        */
+       protected function getFieldEvalCacheIdentifier($additionalIdentifier) {
+               return 'core-datahandler-eval-' . md5($additionalIdentifier);
+       }
+
+       /**
         * function to make the static call to GeneralUtility mockable
         *
         * @return RelationHandler