Deprecation: #109523 - GeneralUtility::isOnCurrentHost() without PSR-7 request
See forge#109523
Description
Calling
\TYPO3\ without
providing a PSR-7
\Psr\ as the
second argument is deprecated.
The method previously resolved the current host via
\TYPO3\,
which hides an implicit dependency on server globals. The method signature has been
extended to accept an explicit PSR-7 request object, which should be passed instead.
Impact
A PHP
E_ error is triggered when
\TYPO3\ is called without a
\Server argument.
Affected installations
All installations with third-party extensions that call
\TYPO3\ with
only one argument.
Migration
Pass the current PSR-7 request as the second argument to
\TYPO3\.
Before:
use TYPO3\CMS\Core\Utility\GeneralUtility;
$isOnCurrentHost = GeneralUtility::isOnCurrentHost($url);
After:
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
$isOnCurrentHost = GeneralUtility::isOnCurrentHost($url, $request);
The PSR-7 request is available in various places, for example as an argument
in controller actions, via
$GLOBALS in legacy contexts,
and via
\Server method parameters.