Skip to content

Deprecation: #109551 - GeneralUtility::getIndpEnv() #4907

Description

@simonschaufi

Deprecation: #109551 - GeneralUtility::getIndpEnv()

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/14.3/Deprecation-109551-GeneralUtilityGetIndpEnv.html

Deprecation: #109551 - GeneralUtility::getIndpEnv()

See 109551

Description

Method \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv() has been
deprecated.

The method abstracts server environment variables and was used to obtain
request-related data from PHP superglobals, such as the current host,
URI, and site path. This information is reliably available via
\TYPO3\CMS\Core\Http\NormalizedParams, which is attached as an
attribute to the PSR-7 request.

Impact

Calling \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv() triggers
a PHP E_USER_DEPRECATED error.

Affected installations

All installations that call
\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv() directly.

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

Migration

Replace calls to \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv()
with the corresponding \TYPO3\CMS\Core\Http\NormalizedParams getter. A
\TYPO3\CMS\Core\Http\NormalizedParams instance is available as an
attribute of the PSR-7 request:

// Before
use TYPO3\CMS\Core\Utility\GeneralUtility;

$siteUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
$host = GeneralUtility::getIndpEnv('HTTP_HOST');

// After
use TYPO3\CMS\Core\Http\NormalizedParams;

/** @var NormalizedParams $normalizedParams */
$normalizedParams = $request->getAttribute('normalizedParams');
$siteUrl = $normalizedParams->getSiteUrl();
$host = $normalizedParams->getHttpHost();

PHP-API, FullyScanned, ext:core

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions