Skip to content
  • Benni Mack's avatar
    [TASK] Merge PSR-7 request and _GET/_POST parameters · a4ae5ffe
    Benni Mack authored and Frank Nägler's avatar Frank Nägler committed
    When hooks modify _GET or _POST parameters,
    it is important that these changes reflect the PSR-7 request
    for now, as long as TYPO3 access the _GET/_POST parameters
    via GeneralUtility::_GP().
    
    In order to move away from global access, we still want to avoid
    places where it is unclear to use $_GET/$_POST vs.
    $GLOBALS['TYPO3_REQUEST'] until all parts are completely
    "global-scope free" for GET/POST parameters.
    
    The change adds the initial GET/POST parameters to the
    request object in the very first middleware of the frontend.
    
    If these have been modified when the RequestHandler builds
    up the content, they are added on top of the PSR-7 request object.
    
    Additionally, if the PSR-7 request object has been modified,
    these changes are put back in the global scope to reliably use
    _GPmerged within Extbase and
    
    Additionally, if _GET/_POST have been modified, a warning will
    be shown in the TimeTracker to find out that there have been
    modifications.
    
    Until then, it is safe to continue to access _GET/_POST within
    Hooks and Frontend, however it is highly discouraged to *modify*
    _GET/_POST directly as this functionality will be breaking in TYPO3 v10.0.
    
    Bottom line: This safety net can now trigger deprecation warnings
    if _GET/_POST have been modified during PSR-15 middleware hooks.
    
    Bottom line 2: If these have been modified, they are put inside the
    current request object.
    
    Bottom line 3: If the request object has been modified, global state
    will be modified ONCE in one place to ensure that we work with
    the same object during the request phase.
    
    Bottom line 4: We cannot get away from the current state of
    running a TYPO3 Frontend Request from another source, and
    we try to maintain compatibilty for legacy scripts for now. However,
    this will be breaking in TYPO3 v10.0.
    
    Resolves: #86458
    Releases: master
    Change-Id: Ic8f4f123bb5ea0d660e500494cf06a965dea03c4
    Reviewed-on: https://review.typo3.org/58443
    
    
    Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
    Tested-by: default avatarTYPO3com <no-reply@typo3.com>
    Reviewed-by: default avatarOliver Hader <oliver.hader@typo3.org>
    Tested-by: default avatarOliver Hader <oliver.hader@typo3.org>
    Reviewed-by: default avatarFrank Naegler <frank.naegler@typo3.org>
    Tested-by: default avatarFrank Naegler <frank.naegler@typo3.org>
    a4ae5ffe