Deprecation: #94193 - Public URLs with relative paths in FAL API

See Issue #94193

Description

The public FAL API for accessing the public url of a FAL object, for example \TYPO3\CMS\Core\Resource\FileReference or \TYPO3\CMS\Core\Resource\Folder, previously allowed to retrieve the relative path instead of the absolute path. This could be achieved by setting $relativeToCurrentScript to true while calling getPublicUrl().

FAL is only able to build relative links for local drivers. Other drivers would still return the absolute URL, which has often led to unexpected side effects.

Since both, frontend (site handling) and backend (url routing) are meanwhile fully capable of supporting absolute URLs, $relativeToCurrentScript is now deprecated and will be removed in TYPO3 v12.

This also affects the isRelativeToCurrentScript() method in the GeneratePublicUrlForResourceEvent event, as well as the OnlineMediaHelperInterface.

Impact

Calling getPublicUrl() on a FAL object, for example \TYPO3\CMS\Core\Resource\FileReference or \TYPO3\CMS\Core\Resource\Folder, with $relativeToCurrentScript set to true will trigger a PHP E_USER_DEPRECATED error. The extension scanner will detect such calls.

Accessing isRelativeToCurrentScript() on GeneratePublicUrlForResourceEvent will trigger a PHP E_USER_DEPRECATED error. The extension scanner will detect such calls.

Manually calling getPublicUrl() on an OnlineMediaHelper, for example YoutubeHelper, will not trigger a PHP E_USER_DEPRECATED error, but the extension scanner will detect such calls.

Affected Installations

All installations which set $relativeToCurrentScript to true when calling getPublicUrl() on a FAL object, for example \TYPO3\CMS\Core\Resource\FileReference or \TYPO3\CMS\Core\Resource\Folder.

All installations which manually call getPublicUrl() on an \TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelper, for example \TYPO3\CMS\Core\Resource\Rendering\YoutubeRenderer.

All installation which access isRelativeToCurrentScript() on the \TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent event.

Migration

Remove the $relativeToCurrentScript parameter from all calls to getPublicUrl() on FAL objects, for example \TYPO3\CMS\Core\Resource\FileReference or \TYPO3\CMS\Core\Resource\Folder.

Remove the $relativeToCurrentScript parameter from all manual calls to getPublicUrl() on a \TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelper, for example \TYPO3\CMS\Core\Resource\Rendering\YoutubeRenderer.

Remove all calls to \TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent->isRelativeToCurrentScript().