[TASK] Clean up GeneralUtility::callUserFunction() 65/47465/2
authorBenni Mack <benni@typo3.org>
Thu, 31 Mar 2016 16:02:23 +0000 (18:02 +0200)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Thu, 31 Mar 2016 16:20:18 +0000 (18:20 +0200)
The callUserFunction() method is called in various places
with wrong arguments (parameter 4 and 5).

The patch streamlines the calls.

Resolves: #75339
Releases: master
Change-Id: I05896369fa0cbf3bf5da95dd99b919e671ca06a6
Reviewed-on: https://review.typo3.org/47465
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/backend/Classes/Form/Wizard/SuggestWizardDefaultReceiver.php
typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php
typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Form/TypoScriptConstantsViewHelper.php
typo3/sysext/frontend/Classes/Controller/ExtDirectEidController.php
typo3/sysext/setup/Classes/Controller/SetupModuleController.php

index ce4d795..749c160 100644 (file)
@@ -394,7 +394,7 @@ class SuggestWizardDefaultReceiver
                 'row' => $row,
                 'entry' => &$entry
             );
-            GeneralUtility::callUserFunction($this->config['renderFunc'], $params, $this, '');
+            GeneralUtility::callUserFunction($this->config['renderFunc'], $params, $this);
         }
         return $entry;
     }
index 3075eb7..ab791a1 100644 (file)
@@ -199,7 +199,7 @@ class AjaxRequestHandler implements RequestHandlerInterface
         } elseif ($csrfTokenCheck && !$this->isValidRequest($request)) {
             $ajaxObj->setError('Invalid CSRF token detected for ajaxID "' . $ajaxID . '"!');
         } else {
-            $success = GeneralUtility::callUserFunction($ajaxScript, $ajaxParams, $ajaxObj, false, true);
+            $success = GeneralUtility::callUserFunction($ajaxScript, $ajaxParams, $ajaxObj, '', 1);
             if ($success === false) {
                 $ajaxObj->setError('Registered backend function for ajaxID "' . $ajaxID . '" was not found.');
             }
index 989e592..c1acf27 100644 (file)
@@ -1286,7 +1286,7 @@ class ExtendedTemplateService extends TemplateService
                         case 'user':
                             $userFunction = $typeDat['paramstr'];
                             $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV);
-                            $p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this, '');
+                            $p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this);
                             break;
                         case 'small':
 
index ca8f8af..2271719 100755 (executable)
@@ -3841,12 +3841,12 @@ class GeneralUtility
      * @param string $funcName Function/Method reference or Closure, '[file-reference":"]["&"]class/function["->"method-name]'. You can prefix this reference with "[file-reference]:" and \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName() will then be used to resolve the filename and subsequently include it by "require_once()" which means you don't have to worry about including the class file either! Example: "EXT:realurl/class.tx_realurl.php:&tx_realurl->encodeSpURL". Finally; you can prefix the class name with "&" if you want to reuse a former instance of the same object call ("singleton").
      * @param mixed $params Parameters to be pass along (typically an array) (REFERENCE!)
      * @param mixed $ref Reference to be passed along (typically "$this" - being a reference to the calling object) (REFERENCE!)
-     * @param string $checkPrefix Not used anymore since 6.0
+     * @param string $_ Not used anymore since 6.0
      * @param int $errorMode Error mode (when class/function could not be found): 0 - call debug(), 1 - do nothing, 2 - raise an exception (allows to call a user function that may return FALSE)
      * @return mixed Content from method/function call or FALSE if the class/method/function was not found
      * @see getUserObj()
      */
-    public static function callUserFunction($funcName, &$params, &$ref, $checkPrefix = '', $errorMode = 0)
+    public static function callUserFunction($funcName, &$params, &$ref, $_ = '', $errorMode = 0)
     {
         $content = false;
         // Check if we're using a closure and invoke it directly.
index c217d39..0fa0011 100644 (file)
@@ -290,7 +290,7 @@ class TypoScriptConstantsViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abs
             'fieldValue' => $configuration->getValue(),
             'propertyName' => $configuration->getName()
         );
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this, '');
+        return \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this);
     }
 
     /**
index 052a2b5..fcaa103 100644 (file)
@@ -45,7 +45,7 @@ class ExtDirectEidController
         $ajaxScript = $GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX']['ExtDirect::' . $ajaxID]['callbackMethod'];
         $this->ajaxObject = GeneralUtility::makeInstance(AjaxRequestHandler::class, 'ExtDirect::' . $ajaxID);
         $parameters = array();
-        GeneralUtility::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, false, true);
+        GeneralUtility::callUserFunction($ajaxScript, $parameters, $this->ajaxObject, '', 1);
     }
 
     /**
index 68255f1..2737aa6 100644 (file)
@@ -550,7 +550,7 @@ class SetupModuleController extends AbstractModule
                     break;
                 case 'select':
                     if ($config['itemsProcFunc']) {
-                        $html = GeneralUtility::callUserFunction($config['itemsProcFunc'], $config, $this, '');
+                        $html = GeneralUtility::callUserFunction($config['itemsProcFunc'], $config, $this);
                     } else {
                         $html = '<select id="field_' . htmlspecialchars($fieldName) . '"
                             name="data' . $dataAdd . '[' . htmlspecialchars($fieldName) . ']"' .
@@ -562,7 +562,7 @@ class SetupModuleController extends AbstractModule
                     }
                     break;
                 case 'user':
-                    $html = GeneralUtility::callUserFunction($config['userFunc'], $config, $this, '');
+                    $html = GeneralUtility::callUserFunction($config['userFunc'], $config, $this);
                     break;
                 case 'button':
                     if ($config['onClick']) {