From 3456ae0a791f5369e3a6ff174a6477310ce5cde1 Mon Sep 17 00:00:00 2001 From: Larry Garfield <larry@garfieldtech.com> Date: Tue, 4 May 2021 12:03:19 -0500 Subject: [PATCH] [TASK] Remove usages of call_user_func() and call_user_func_array() Using direct calls and variadics is slightly faster, and usually cleaner to read. I left in the instant-call call_user_func() instances in the entry point files, as that's only a single call and is arguably at least no worse than (function() {})(). Resolves: #94060 Releases: master Change-Id: I95988feadf8522d8d936a273608e0ef2d5ce75b5 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69017 Tested-by: Benjamin Franzke <bfr@qbus.de> Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benjamin Franzke <bfr@qbus.de> Reviewed-by: crell <larry@garfieldtech.com> Reviewed-by: Benni Mack <benni@typo3.org> --- .../backend/Classes/Http/RouteDispatcher.php | 2 +- .../Tree/Repository/PageTreeRepository.php | 2 +- .../Configuration/FlexForm/FlexFormTools.php | 2 +- .../Classes/Console/CommandApplication.php | 2 +- .../core/Classes/DataHandling/DataHandler.php | 4 ++-- .../core/Classes/DataHandling/SlugHelper.php | 2 +- .../core/Classes/Database/RelationHandler.php | 2 +- .../core/Classes/Http/AbstractApplication.php | 2 +- typo3/sysext/core/Classes/Http/Dispatcher.php | 4 ++-- .../Classes/Resource/Driver/LocalDriver.php | 6 +++--- .../Resource/Filter/FileExtensionFilter.php | 4 ++-- .../Classes/Resource/Filter/FileNameFilter.php | 4 ++-- .../Result/DriverFilteredSearchResult.php | 4 ++-- .../core/Classes/Utility/ArrayUtility.php | 4 ++-- .../core/Classes/Utility/GeneralUtility.php | 7 ++----- .../Functional/Error/ErrorHandlerTest.php | 2 +- .../IO/PharStreamWrapperInterceptorTest.php | 4 ++-- .../FormProtectionFactoryTest.php | 4 ++-- .../sysext/core/Tests/Unit/Log/LoggerTest.php | 2 +- .../core/Tests/Unit/Resource/FileTest.php | 2 +- .../Mvc/Controller/ActionController.php | 6 ++---- .../Persistence/Generic/LazyLoadingProxy.php | 2 +- .../Property/TypeConverter/ObjectConverter.php | 2 +- .../extbase/Classes/SignalSlot/Dispatcher.php | 2 +- .../PropertyMappingConfigurationTest.php | 2 +- typo3/sysext/filelist/Classes/FileFacade.php | 18 +++++++++--------- .../ContentObject/ContentObjectRenderer.php | 6 +----- .../SiteHandling/AbstractTestCase.php | 2 +- .../Controller/RecyclerModuleController.php | 2 +- 29 files changed, 49 insertions(+), 58 deletions(-) diff --git a/typo3/sysext/backend/Classes/Http/RouteDispatcher.php b/typo3/sysext/backend/Classes/Http/RouteDispatcher.php index 67e95aa53077..a13d078c0bbb 100644 --- a/typo3/sysext/backend/Classes/Http/RouteDispatcher.php +++ b/typo3/sysext/backend/Classes/Http/RouteDispatcher.php @@ -60,7 +60,7 @@ class RouteDispatcher extends Dispatcher $targetIdentifier = $route->getOption('target'); $target = $this->getCallableFromTarget($targetIdentifier); $arguments = [$request]; - return call_user_func_array($target, $arguments); + return $target(...$arguments); } /** diff --git a/typo3/sysext/backend/Classes/Tree/Repository/PageTreeRepository.php b/typo3/sysext/backend/Classes/Tree/Repository/PageTreeRepository.php index 5a08271f25d6..5fa61163b2cf 100644 --- a/typo3/sysext/backend/Classes/Tree/Repository/PageTreeRepository.php +++ b/typo3/sysext/backend/Classes/Tree/Repository/PageTreeRepository.php @@ -155,7 +155,7 @@ class PageTreeRepository return; } foreach ($tree['_children'] as $k => &$childPage) { - if (!call_user_func_array($callback, [$childPage])) { + if (!$callback($childPage)) { unset($tree['_children'][$k]); continue; } diff --git a/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php b/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php index 03fc558e3a85..ac097049cfd9 100644 --- a/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php +++ b/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php @@ -882,7 +882,7 @@ class FlexFormTools */ protected function executeCallBackMethod($methodName, array $parameterArray) { - return call_user_func_array([$this->callBackObj, $methodName], $parameterArray); + return $this->callBackObj->$methodName(...$parameterArray); } /*********************************** diff --git a/typo3/sysext/core/Classes/Console/CommandApplication.php b/typo3/sysext/core/Classes/Console/CommandApplication.php index 3a637e9b3715..6951904389e2 100644 --- a/typo3/sysext/core/Classes/Console/CommandApplication.php +++ b/typo3/sysext/core/Classes/Console/CommandApplication.php @@ -110,7 +110,7 @@ class CommandApplication implements ApplicationInterface $exitCode = $this->application->run($input, $output); if ($execute !== null) { - call_user_func($execute); + $execute(); } exit($exitCode); diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 49a0126c8a53..c7d71010ff27 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -6182,7 +6182,7 @@ class DataHandler implements LoggerAwareInterface if (!empty($remapAction['func'])) { $callable = [$this, $remapAction['func']]; if (is_callable($callable)) { - $newValue = call_user_func_array($callable, $remapAction['args']); + $newValue = $callable(...$remapAction['args']); } } // If array is returned, check for maxitems condition, if string is returned this was already done: @@ -6252,7 +6252,7 @@ class DataHandler implements LoggerAwareInterface if ($this->remapStackActions) { foreach ($this->remapStackActions as $action) { if (isset($action['callback'], $action['arguments'])) { - call_user_func_array($action['callback'], $action['arguments']); + $action['callback'](...$action['arguments']); } } } diff --git a/typo3/sysext/core/Classes/DataHandling/SlugHelper.php b/typo3/sysext/core/Classes/DataHandling/SlugHelper.php index 88359ee319f2..d5fca085c6e3 100644 --- a/typo3/sysext/core/Classes/DataHandling/SlugHelper.php +++ b/typo3/sysext/core/Classes/DataHandling/SlugHelper.php @@ -382,7 +382,7 @@ class SlugHelper $newValue = $slug; $counter = 0; while ( - !call_user_func($isUnique, $newValue, $state) + !$isUnique($newValue, $state) && ++$counter < 100 ) { $newValue = $this->sanitize($rawValue . '-' . $counter); diff --git a/typo3/sysext/core/Classes/Database/RelationHandler.php b/typo3/sysext/core/Classes/Database/RelationHandler.php index 4984ca7a5113..05399643e89a 100644 --- a/typo3/sysext/core/Classes/Database/RelationHandler.php +++ b/typo3/sysext/core/Classes/Database/RelationHandler.php @@ -1409,7 +1409,7 @@ class RelationHandler $purgedItemIds = []; $callable =[$this, $purgeCallback]; if (is_callable($callable)) { - $purgedItemIds = call_user_func($callable, $itemTableName, $itemIds); + $purgedItemIds = $callable($itemTableName, $itemIds); } $removedItemIds = array_diff($itemIds, $purgedItemIds); diff --git a/typo3/sysext/core/Classes/Http/AbstractApplication.php b/typo3/sysext/core/Classes/Http/AbstractApplication.php index 0b2d2d28807e..3e77c6d52c90 100644 --- a/typo3/sysext/core/Classes/Http/AbstractApplication.php +++ b/typo3/sysext/core/Classes/Http/AbstractApplication.php @@ -97,7 +97,7 @@ abstract class AbstractApplication implements ApplicationInterface, RequestHandl ServerRequestFactory::fromGlobals() ); if ($execute !== null) { - call_user_func($execute); + $execute(); } } catch (ImmediateResponseException $exception) { $response = $exception->getResponse(); diff --git a/typo3/sysext/core/Classes/Http/Dispatcher.php b/typo3/sysext/core/Classes/Http/Dispatcher.php index 0542d02e86a7..7d62375bd3d9 100644 --- a/typo3/sysext/core/Classes/Http/Dispatcher.php +++ b/typo3/sysext/core/Classes/Http/Dispatcher.php @@ -50,12 +50,12 @@ class Dispatcher implements DispatcherInterface $targetIdentifier = $request->getAttribute('target'); $target = $this->getCallableFromTarget($targetIdentifier); $arguments = [$request]; - return call_user_func_array($target, $arguments); + return $target(...$arguments); } /** * Creates a callable out of the given parameter, which can be a string, a callable / closure or an array - * which can be handed to call_user_func_array() + * which can be invoked as a function. * * @param array|string|callable $target the target which is being resolved. * @return callable diff --git a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php index c150418c17fd..6cf4e8782f25 100644 --- a/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php +++ b/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php @@ -422,9 +422,9 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver implements Stream { foreach ($filterMethods as $filter) { if (is_callable($filter)) { - $result = call_user_func($filter, $itemName, $itemIdentifier, $parentIdentifier, [], $this); - // We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE - // If calling the method succeeded and thus we can't use that as a return value. + $result = $filter($itemName, $itemIdentifier, $parentIdentifier, [], $this); + // We use -1 as the "don't include“ return value, for historic reasons, + // as call_user_func() used to return FALSE if calling the method failed. if ($result === -1) { return false; } diff --git a/typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php b/typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php index efac558cb468..a17310494915 100644 --- a/typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php +++ b/typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php @@ -84,8 +84,8 @@ class FileExtensionFilter /** * Entry method for use as filelist filter. * - * We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE - * if calling the method failed and thus we can't use that as a return value. + * We use -1 as the "don't include“ return value, for historic reasons, + * as call_user_func() used to return FALSE if calling the method failed. * * @param string $itemName * @param string $itemIdentifier diff --git a/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php b/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php index d47232b1f2b0..fc4638907c2f 100644 --- a/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php +++ b/typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php @@ -32,8 +32,8 @@ class FileNameFilter /** * Filter method that checks if a file/folder name starts with a dot (e.g. .htaccess) * - * We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE - * If calling the method succeeded and thus we can't use that as a return value. + * We use -1 as the "don't include“ return value, for historic reasons, + * as call_user_func() used to return FALSE if calling the method failed. * * @param string $itemName * @param string $itemIdentifier diff --git a/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php b/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php index befbf85afecf..019c3820226e 100644 --- a/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php +++ b/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php @@ -142,8 +142,8 @@ class DriverFilteredSearchResult implements FileSearchResultInterface continue; } $result = $filter($itemName, $itemIdentifier, $parentIdentifier, [], $this->driver); - // We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE - // If calling the method succeeded and thus we can't use that as a return value. + // We use -1 as the "don't include“ return value, for historic reasons, + // as call_user_func() used to return FALSE if calling the method failed. if ($result === -1) { $matches = false; } diff --git a/typo3/sysext/core/Classes/Utility/ArrayUtility.php b/typo3/sysext/core/Classes/Utility/ArrayUtility.php index 6b638725fa93..c3657c27329f 100644 --- a/typo3/sysext/core/Classes/Utility/ArrayUtility.php +++ b/typo3/sysext/core/Classes/Utility/ArrayUtility.php @@ -698,7 +698,7 @@ class ArrayUtility $keepItems = array_flip($keepItems); foreach ($array as $key => $value) { // Get the value to compare by using the callback function: - $keepValue = isset($getValueFunc) ? call_user_func($getValueFunc, $value) : $value; + $keepValue = isset($getValueFunc) ? $getValueFunc($value) : $value; if (!isset($keepItems[$keepValue])) { unset($array[$key]); } @@ -862,7 +862,7 @@ class ArrayUtility $array[$key] = self::filterRecursive($value, $callback); } - if (!call_user_func($callback, $value)) { + if (!$callback($value)) { unset($array[$key]); } } diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 8e128d88f340..cbe3ea393c7e 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -623,15 +623,12 @@ class GeneralUtility $ipad = str_repeat(chr(54), $hashBlocksize); if (strlen($secret) > $hashBlocksize) { // Keys longer than block size are shorten - $key = str_pad(pack('H*', call_user_func($hashAlgorithm, $secret)), $hashBlocksize, "\0"); + $key = str_pad(pack('H*', $hashAlgorithm($secret)), $hashBlocksize, "\0"); } else { // Keys shorter than block size are zero-padded $key = str_pad($secret, $hashBlocksize, "\0"); } - $hmac = call_user_func($hashAlgorithm, ($key ^ $opad) . pack('H*', call_user_func( - $hashAlgorithm, - ($key ^ $ipad) . $input - ))); + $hmac = $hashAlgorithm(($key ^ $opad) . pack('H*', $hashAlgorithm(($key ^ $ipad) . $input))); } return $hmac; } diff --git a/typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php b/typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php index 1ac6d991cea4..596f3b08b0fd 100644 --- a/typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php +++ b/typo3/sysext/core/Tests/Functional/Error/ErrorHandlerTest.php @@ -113,7 +113,7 @@ class ErrorHandlerTest extends FunctionalTestCase { // process errors if ($this->existingHandler !== null) { - return call_user_func($this->existingHandler, $code, $message, $file, $line, $context); + return ($this->existingHandler)($code, $message, $file, $line, $context); } return false; diff --git a/typo3/sysext/core/Tests/Functional/IO/PharStreamWrapperInterceptorTest.php b/typo3/sysext/core/Tests/Functional/IO/PharStreamWrapperInterceptorTest.php index 3bf3ad6cff4e..14a3e53d0b3b 100644 --- a/typo3/sysext/core/Tests/Functional/IO/PharStreamWrapperInterceptorTest.php +++ b/typo3/sysext/core/Tests/Functional/IO/PharStreamWrapperInterceptorTest.php @@ -213,7 +213,7 @@ class PharStreamWrapperInterceptorTest extends FunctionalTestCase self::assertSame( $expectation, - call_user_func($functionName, 'phar://' . $path) + $functionName('phar://' . $path) ); } @@ -282,7 +282,7 @@ class PharStreamWrapperInterceptorTest extends FunctionalTestCase self::expectExceptionCode(1539625084); $path = $this->instancePath . '/' . $path; - call_user_func($functionName, 'phar://' . $path); + $functionName('phar://' . $path); } /** diff --git a/typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php b/typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php index fc1326b53f9e..9bb65d2a4909 100644 --- a/typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php +++ b/typo3/sysext/core/Tests/Unit/FormProtection/FormProtectionFactoryTest.php @@ -90,8 +90,8 @@ class FormProtectionFactoryTest extends UnitTestCase $this->createMock(Registry::class) ]; self::assertSame( - call_user_func_array([FormProtectionFactory::class, 'get'], $arguments), - call_user_func_array([FormProtectionFactory::class, 'get'], $arguments) + FormProtectionFactory::get(...$arguments), + FormProtectionFactory::get(...$arguments) ); } diff --git a/typo3/sysext/core/Tests/Unit/Log/LoggerTest.php b/typo3/sysext/core/Tests/Unit/Log/LoggerTest.php index 57d09260b9ef..12693d9538bd 100644 --- a/typo3/sysext/core/Tests/Unit/Log/LoggerTest.php +++ b/typo3/sysext/core/Tests/Unit/Log/LoggerTest.php @@ -159,7 +159,7 @@ class LoggerTest extends UnitTestCase $logger = new Logger('test.core.log'); $writer = new WriterFixture(); $logger->addWriter(LogLevel::DEBUG, $writer); - call_user_func([$logger, $shorthandMethod], 'test message'); + $logger->$shorthandMethod('test message'); self::assertNotEmpty($writer->getRecords()); } diff --git a/typo3/sysext/core/Tests/Unit/Resource/FileTest.php b/typo3/sysext/core/Tests/Unit/Resource/FileTest.php index 7582c1627e3d..cd45928842b6 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/FileTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/FileTest.php @@ -74,7 +74,7 @@ class FileTest extends UnitTestCase ]; $fixture = new File($properties, $this->storageMock); foreach ($properties as $key => $value) { - self::assertEquals($value, call_user_func([$fixture, 'get' . $key])); + self::assertEquals($value, $fixture->{'get' . $key}()); } } diff --git a/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php b/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php index d23877d91466..2b8e1119d153 100644 --- a/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php +++ b/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php @@ -472,10 +472,8 @@ abstract class ActionController implements ControllerInterface $actionInitializationMethodName = 'initialize' . ucfirst($this->actionMethodName); /** @var callable $callable */ $callable = [$this, $actionInitializationMethodName]; - if (method_exists($this, $actionInitializationMethodName)) { - // todo: replace method_exists with is_callable or even both - // method_exists alone does not guarantee that $callable is actually callable - call_user_func($callable); + if (is_callable($callable)) { + $callable(); } $this->mapRequestArgumentsToControllerArguments(); $this->controllerContext = $this->buildControllerContext(); diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php index 0a3c2c31cc07..673acb0d28a3 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php @@ -147,7 +147,7 @@ class LazyLoadingProxy implements \Iterator, LoadingStrategyInterface } /** @var callable $callable */ $callable = [$realInstance, $methodName]; - return call_user_func_array($callable, $arguments); + return $callable(...$arguments); } /** diff --git a/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php b/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php index 0793d0d14d47..7aa3e991b816 100644 --- a/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php +++ b/typo3/sysext/extbase/Classes/Property/TypeConverter/ObjectConverter.php @@ -257,7 +257,7 @@ class ObjectConverter extends AbstractTypeConverter throw new InvalidTargetException('Missing constructor argument "' . $parameterName . '" for object of type "' . $objectType . '".', 1268734872); } } - return call_user_func_array([$this->objectManager, 'get'], array_merge([$objectType], $constructorArguments)); + return $this->objectManager->get(...[$objectType, ...$constructorArguments]); } return $this->objectManager->get($objectType); } diff --git a/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php b/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php index 0cb95f5b4524..724d2620aab1 100644 --- a/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php +++ b/typo3/sysext/extbase/Classes/SignalSlot/Dispatcher.php @@ -144,7 +144,7 @@ class Dispatcher implements SingletonInterface $preparedSlotArguments[] = $signalClassName . '::' . $signalName; } - $slotReturn = call_user_func_array($callable, $preparedSlotArguments); + $slotReturn = $callable(...$preparedSlotArguments); if ($slotReturn) { if (!is_array($slotReturn)) { diff --git a/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php b/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php index 5ed579c6a2f3..a2eceb129b02 100644 --- a/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php +++ b/typo3/sysext/extbase/Tests/Unit/Property/PropertyMappingConfigurationTest.php @@ -223,7 +223,7 @@ class PropertyMappingConfigurationTest extends UnitTestCase */ public function respectiveMethodsProvideFluentInterface($methodToTestForFluentInterface, array $argumentsForMethod = []) { - $actualResult = call_user_func_array([$this->propertyMappingConfiguration, $methodToTestForFluentInterface], $argumentsForMethod); + $actualResult = $this->propertyMappingConfiguration->$methodToTestForFluentInterface(...$argumentsForMethod); self::assertSame($this->propertyMappingConfiguration, $actualResult); } diff --git a/typo3/sysext/filelist/Classes/FileFacade.php b/typo3/sysext/filelist/Classes/FileFacade.php index 32741b66e7ab..c4d28145afcf 100644 --- a/typo3/sysext/filelist/Classes/FileFacade.php +++ b/typo3/sysext/filelist/Classes/FileFacade.php @@ -98,7 +98,7 @@ class FileFacade $uid = 0; $method = 'getMetadata'; if (is_callable([$this->resource, $method])) { - $metadata = call_user_func([$this->resource, $method]); + $metadata = $this->resource->$method(); if (isset($metadata['uid'])) { $uid = (int)$metadata['uid']; @@ -123,7 +123,7 @@ class FileFacade { $method = 'getReadablePath'; if (is_callable([$this->resource->getParentFolder(), $method])) { - return call_user_func([$this->resource->getParentFolder(), $method]); + return $this->resource->getParentFolder()->$method(); } return ''; @@ -176,7 +176,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['read']); + return $this->resource->$method('read'); } return false; @@ -189,7 +189,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['write']); + return $this->resource->$method('write'); } return false; @@ -202,7 +202,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['replace']); + return $this->resource->$method('replace'); } return false; @@ -215,7 +215,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['rename']); + return $this->resource->$method('rename'); } return false; @@ -228,7 +228,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['copy']); + return $this->resource->$method('copy'); } return false; @@ -241,7 +241,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['move']); + return $this->resource->$method('move'); } return false; @@ -254,7 +254,7 @@ class FileFacade { $method = 'checkActionPermission'; if (is_callable([$this->resource, $method])) { - return call_user_func_array([$this->resource, $method], ['delete']); + return $this->resource->$method('delete'); } return false; diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index fc14ca930b09..e532f830e354 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -5181,11 +5181,7 @@ class ContentObjectRenderer implements LoggerAwareInterface $callable = [$classObj, $methodName]; if (is_object($classObj) && method_exists($classObj, $parts[1]) && is_callable($callable)) { $classObj->cObj = $this; - $content = call_user_func_array($callable, [ - $content, - $conf, - $this->getRequest() - ]); + $content = $callable($content, $conf, $this->getRequest()); } else { $this->getTimeTracker()->setTSlogMessage('Method "' . $parts[1] . '" did not exist in class "' . $parts[0] . '"', 3); } diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/AbstractTestCase.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/AbstractTestCase.php index df63f3754822..3af7974c59e8 100644 --- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/AbstractTestCase.php +++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/AbstractTestCase.php @@ -106,7 +106,7 @@ abstract class AbstractTestCase extends FunctionalTestCase array_map( function (array $values) use ($template, $callback) { if ($callback !== null) { - $values = call_user_func($callback, $values); + $values = $callback($values); } return vsprintf($template, $values); }, diff --git a/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php b/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php index 5ebd100fb6ee..8701d60c7bbe 100644 --- a/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php +++ b/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php @@ -123,7 +123,7 @@ class RecyclerModuleController $action = 'index'; $this->initializeView($action); - $result = call_user_func_array([$this, $action . 'Action'], [$request]); + $result = $this->{$action . 'Action'}($request); if ($result instanceof ResponseInterface) { return $result; } -- GitLab