Hi!
Thanks for building this little extension - it helps tremendously when building assets with webpack. :)
Problem
if (($extensionConfig = $cache->get($configCacheIdentifier)) === false) { // (1)
$systemConfig = $tsfe->config;
if (isset($systemConfig['config']) && isset($systemConfig['config']['cdn_assets.'])) { // (2)
$extensionConfig = $systemConfig['config']['cdn_assets.'];
}
try {
// Remove dots from TypoScript array
$extensionConfig = GeneralUtility::removeDotsFromTS($extensionConfig); // (3)
When no cache entry is returned at (1), then $extensionConfig is false.
Following, if isset($systemConfig['config']['cdn_assets.']) at (2) then GeneralUtility::removeDotsFromTS(array $array) will be called with a bool parameter, causing a Fatal Error:
Argument 1 passed to TYPO3\CMS\Core\Utility\GeneralUtility::removeDotsFromTS() must be of the type array, bool given
It might not be obvious why you'd ever want to not define config.cdn_assets - but on a multi-site TYPO3 installation this is not unusual at all, if you use asset manifests only for some of the sites in the page tree.
Solution
Option A
Set $extensionConfig to a sane [] value after (1):
if (($extensionConfig = $cache->get($configCacheIdentifier)) === false) { // (1)
$extensionConfig = [];
$systemConfig = $tsfe->config;
if (isset($systemConfig['config']) && isset($systemConfig['config']['cdn_assets.'])) { // (2)
$extensionConfig = $systemConfig['config']['cdn_assets.'];
}
try {
// Remove dots from TypoScript array
$extensionConfig = GeneralUtility::removeDotsFromTS($extensionConfig); // (3)
Option B
Alternatively, use ?: when calling removeDotsFromTS() at (3):
$extensionConfig = GeneralUtility::removeDotsFromTS($extensionConfig ?: []); // (3)
Hi!
Thanks for building this little extension - it helps tremendously when building assets with webpack. :)
Problem
When no cache entry is returned at
(1), then$extensionConfigisfalse.Following, if
isset($systemConfig['config']['cdn_assets.'])at(2)thenGeneralUtility::removeDotsFromTS(array $array)will be called with aboolparameter, causing a Fatal Error:It might not be obvious why you'd ever want to not define config.cdn_assets - but on a multi-site TYPO3 installation this is not unusual at all, if you use asset manifests only for some of the sites in the page tree.
Solution
Option A
Set
$extensionConfigto a sane[]value after(1):Option B
Alternatively, use
?:when callingremoveDotsFromTS()at(3):