Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
simonschaufi opened this issue Nov 3, 2023 · 1 comment
Closed

Comments

@simonschaufi
Copy link
Collaborator

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

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.3/Deprecation-94193-PublicUrlWithRelativePathsInFALAPI.html
.. include:: /Includes.rst.txt

.. _deprecation-94193:

================================================================
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 :php:\TYPO3\CMS\Core\Resource\FileReference or
:php:\TYPO3\CMS\Core\Resource\Folder, previously allowed to
retrieve the relative path instead of the absolute path. This could
be achieved by setting :php:$relativeToCurrentScript to :php:true
while calling :php: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, :php:$relativeToCurrentScript
is now deprecated and will be removed in TYPO3 v12.

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

Impact

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

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

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

Affected Installations

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

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

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

Migration

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

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

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

.. index:: FAL, PHP-API, FullyScanned, ext:core

@sabbelasichon
Copy link
Owner

Duplicate of #2591

@sabbelasichon sabbelasichon marked this as a duplicate of #2591 Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants