Skip to content
Snippets Groups Projects
Commit 68aa03bd authored by Simon Gilli's avatar Simon Gilli Committed by Georg Ringer
Browse files

[BUGFIX] Ensure TranslateViewHelper does not fail on invalid extension

Change #95839 introduced a regression that causes TranslateViewHelper
to fail when an invalid extension key is specified. This patch restores
the previous behavior and avoids more regressions by a new test.

Resolves: #95957
Releases: master
Change-Id: I98675f94cf367b43f4123bb981f60c35286ace7a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72158


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarHelmut Hummel <typo3@helhum.io>
Tested-by: default avatarNikita Hovratov <nikita.h@live.de>
Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarHelmut Hummel <typo3@helhum.io>
Reviewed-by: default avatarNikita Hovratov <nikita.h@live.de>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent 771bbc3b
Branches
Tags
No related merge requests found
......@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Core\Localization;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Localization\Exception\FileNotFoundException;
use TYPO3\CMS\Core\Package\Exception\UnknownPackagePathException;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -83,7 +84,7 @@ class LocalizationFactory implements SingletonInterface
// @todo: this (providing an absolute file system path) likely does not work properly anyway in all cases and should rather be deprecated
$LOCAL_LANG = $parser->getParsedData($this->store->getAbsoluteFileReference($fileReference), $languageKey);
}
} catch (FileNotFoundException $exception) {
} catch (FileNotFoundException | UnknownPackagePathException $exception) {
// Source localization file not found, set empty data as there could be an override
$this->store->setData($fileReference, $languageKey, []);
$LOCAL_LANG = $this->store->getData($fileReference);
......
......@@ -76,4 +76,15 @@ class TranslateViewHelperTest extends FunctionalTestCase
$view->setTemplateSource('<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack" />');
self::assertSame('Go back', $view->render());
}
/**
* @test
*/
public function renderReturnsNullOnInvalidExtension(): void
{
$this->setUpBackendUserFromFixture(1);
$view = new StandaloneView();
$view->setTemplateSource('<f:translate key="LLL:EXT:invalid/Resources/Private/Language/locallang.xlf:dummy" />');
self::assertNull($view->render());
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment