Breaking: #92502 - Make Extbase handle PSR-7 responses only¶
See forge#92502
Description¶
Extbase does no longer handle/return extbase responses whose api was defined by the
interface TYPO3\CMS\Extbase\Mvc\ResponseInterface
. Instead, Extbase does create a PSR-7
compatible response object (see Psr\Http\Message\ResponseInterface
) and passes
it back through the request handling stack.
Since PSR-7
requires response objects to be immutable, it no longer makes sense to expose the response object
to the user via TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$response
and TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext->getResponse()
.
The following interface has been removed and is no longer usable:
TYPO3\CMS\Extbase\Mvc\ResponseInterface
The following class has been removed and is no longer usable:
TYPO3\CMS\Extbase\Mvc\Response
Impact¶
Since interface TYPO3\CMS\Extbase\Mvc\ResponseInterface
and class TYPO3\CMS\Extbase\Mvc\Response
have been removed, they can no longer be used.
Affected Installations¶
All installations that:
- declared classes that implemented the interface
TYPO3\CMS\Extbase\Mvc\ResponseInterface
- instantiated or extended class
TYPO3\CMS\Extbase\Mvc\Response
- accessed the request object through
TYPO3\CMS\Extbase\Mvc\Controller\ActionController::$response
orTYPO3\CMS\Extbase\Mvc\Controller\ControllerContext->getResponse()
Migration¶
To regain full control over the response object, a PSR-7 compatible response object SHOULD be created in the controller action and returned instead of returning a string or void.
Example:
public function listAction()
{
// do your action stuff
return $this->htmlResponse();
}
Note
If no argument is given to $this->htmlResponse()
, the current view
is automatically rendered, and applied as content for the PSR-7 Response.
For more information about this topic, please refer to the corresponding
changelog.
Further: Method TYPO3\CMS\Extbase\Mvc\Response::addAdditionalHeaderData()
had been used to add additional header data such as css or js to the global TypoScriptFrontendController.
This has to be done via TYPO3\CMS\Core\Page\AssetCollector
now.