Deprecation: #109548 - GeneralUtility::locationHeaderUrl() without PSR-7 request 

See forge#109548

Description 

Calling \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl() without providing a PSR-7 ServerRequestInterface as second argument is deprecated.

The method previously resolved the current host and request directory via GeneralUtility::getIndpEnv(), 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_USER_DEPRECATED error is triggered when GeneralUtility::locationHeaderUrl() is called without a ServerRequestInterface argument.

Affected installations 

All installations that call GeneralUtility::locationHeaderUrl() without passing a \Psr\Http\Message\ServerRequestInterface as second argument.

The extension scanner will detect affected usages as a strong match.

Migration 

Pass the current PSR-7 request as second argument to GeneralUtility::locationHeaderUrl().

Before:

use TYPO3\CMS\Core\Utility\GeneralUtility;

$url = GeneralUtility::locationHeaderUrl($path);
Copied!

After:

use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;

$url = GeneralUtility::locationHeaderUrl($path, $request);
Copied!

The PSR-7 request is available in various places, for example as an argument in controller actions, via $GLOBALS['TYPO3_REQUEST'] in legacy contexts, or via ServerRequestInterface method parameters.