Deprecation: #92815 - ActionController::forward()

See forge#92815

Description

Method TYPO3\CMS\Extbase\Mvc\Controller\ActionController::forward() has been marked as deprecated in favor of returning a \TYPO3\CMS\Extbase\Http\ForwardResponse in a controller action.

Impact

Calling TYPO3\CMS\Extbase\Mvc\Controller\ActionController::forward(), which itself throws a TYPO3\CMS\Extbase\Mvc\Exception\StopActionException to initiate abortion of the current request and to initiate a new request, will also trigger PHP E_USER_DEPRECATED error.

Affected Installations

All installations using method TYPO3\CMS\Extbase\Mvc\Controller\ActionController::forward().

Migration

Instead of calling the helper method, a controller action must return a \TYPO3\CMS\Extbase\Http\ForwardResponse .

Before:

<?php

use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class FooController extends ActionController
{
   public function listAction()
   {
        // do something

        $this->forward('show');
   }

   // more actions here
}
Copied!

After:

<?php

use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Http\ForwardResponse;

class FooController extends ActionController
{
   public function listAction(): ResponseInterface
   {
        // do something

        return new ForwardResponse('show');
   }

   // more actions here
}
Copied!