Issue Bug Closed

#91184Hook minifyJavaScript triggers deprecated warning

Robert Vock 04/24/20, 08:59 updated 05/12/20, 13:08

Description

When using the Hook `minifyJavaScript`, you will get a Deprecated Warning in TYPO3 v10:

<pre> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['minifyJavaScript'][] = \Example\Extension\Hooks\JavascriptOptimization::class . '->jsMinify'; </pre>

This happens because GeneralUtility::minifyJavaScript calls the callUserFunction method with as third parameter:

GeneralUtility.php#L1694

<pre> $fakeThis = false; foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['minifyJavaScript'] ?? [] as $hookMethod) { try { $parameters = ['script' => $script]; $script = static::callUserFunction($hookMethod, $parameters, $fakeThis); </pre>

which triggers the deprecation:
GeneralUtility.php#L3306

Reviews 1