[BUGFIX] Avoid getUserObj-call for eval 'null' and non-existing hooks 88/36188/2
authorStephan Großberndt <stephan@grossberndt.de>
Thu, 11 Dec 2014 09:32:49 +0000 (10:32 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 22 Jan 2015 21:02:46 +0000 (22:02 +0100)
If the 'eval' definition of a TCA input or text does contain 'null' or
a value without a matching hook, we skip the useless call to
GeneralUtility::getUserObj().

This improves performance especially for bulk inserts with many text
fields.

Resolves: #63750
Releases: master, 6.2
Change-Id: I328f6b3f5e737fa472f7385afc0a2407d16eb1f8
Reviewed-on: http://review.typo3.org/36188
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index fed6dee..b10c076 100644 (file)
@@ -2464,6 +2464,9 @@ class DataHandler {
                                        }
                                        break;
                                default:
+                                       if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func])) {
+                                               break;
+                                       }
                                        $evalObj = GeneralUtility::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func] . ':&' . $func);
                                        if (is_object($evalObj) && method_exists($evalObj, 'evaluateFieldValue')) {
                                                $value = $evalObj->evaluateFieldValue($value, $is_in, $set);
@@ -2576,6 +2579,9 @@ class DataHandler {
                                        }
                                        break;
                                default:
+                                       if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func])) {
+                                               break;
+                                       }
                                        $evalObj = GeneralUtility::getUserObj($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func] . ':&' . $func);
                                        if (is_object($evalObj) && method_exists($evalObj, 'evaluateFieldValue')) {
                                                $value = $evalObj->evaluateFieldValue($value, $is_in, $set);