Actions
Bug #105953
openf:uri.resource cache busting not working and in addition causing PHP warninigs when open_basedir is enabled
Start date:
2025-01-16
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:
Description
The cache buster is not working when using the Uri Resource View Helper. In addition a PHP warning is logged when open_basedir is set.
Core: Error handler (BE): PHP Warning: file_exists(): open_basedir restriction in effect. File(/_assets/1ee1d3e909b58d32e30dcea666dd3224/Images/typo3_light_dark.svg) is not within the allowed path(s): (/var/www/vhosts/me/:/tmp/) in /var/www/vhosts/me/vendor/typo3/cms-core/Classes/Utility/GeneralUtility.php line 2037
(1ee1d3e909b58d32e30dcea666dd3224 symlinks to /var/www/vhosts/me/vendor/typo3/cms-core/Resources/Public)
This is caused in the TYPO3 v13.4.3 backend by:
{f:uri.resource(path: 'EXT:core/Resources/Public/Images/typo3_light_dark.svg')}
The problem is that the uri.resource view helper (vendor/typo3/cms-fluid/Classes/ViewHelpers/Uri/ResourceViewHelper.php) uses the uri path that starts with `/_assest/`
$uri = PathUtility::getPublicResourceWebPath(self::resolveExtensionPath($this->arguments, $this->renderingContext));
if ($this->arguments['useCacheBusting']) {
$uri = GeneralUtility::createVersionNumberedFilename($uri);
}
but createVersionNumberedFilename($file) expects an absolute file path in the file system. In line 2046 it checks the path (that still starts with /_assets/...)
$fileExists = file_exists($path);
what causes the error and sets `$fileExists`to false what results in returning the uri without any changes.
Updated by Christian Ludwig about 1 month ago
- Related to Bug #105403: f:image and cache busting issue added
Updated by Christian Ludwig about 1 month ago
- Related to deleted (Bug #105403: f:image and cache busting issue)
Updated by Christian Ludwig about 1 month ago
- Related to Bug #105403: f:image and cache busting issue added
Updated by Christian Ludwig about 1 month ago
- Related to Feature #103617: Cache busting parameter for f:uri.resource via createVersionNumberedFilename() added
Actions