[!!!][TASK] Remove deprecated web response class 79/64379/6
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Fri, 1 May 2020 09:03:43 +0000 (11:03 +0200)
committerBenjamin Franzke <bfr@qbus.de>
Fri, 29 May 2020 21:08:16 +0000 (23:08 +0200)
The Web Response subclass of Extbase's MVC framework is removed
in favor of the main base Response object, which serves the same
purpose since Extbase MVC is not handling CLI based Responses
anymore in TYPO3 v9.

Releases: master
Resolves: #91526
Related: #91473
Change-Id: I584f60a4702ab031fa60181172d953dc34ce52d7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64379
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benjamin Franzke <bfr@qbus.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benjamin Franzke <bfr@qbus.de>
22 files changed:
typo3/sysext/core/Documentation/Changelog/master/Breaking-91473-DeprecatedFunctionalityRemoved.rst
typo3/sysext/extbase/Classes/Mvc/Response.php
typo3/sysext/extbase/Classes/Mvc/Web/BackendRequestHandler.php
typo3/sysext/extbase/Classes/Mvc/Web/FrontendRequestHandler.php
typo3/sysext/extbase/Classes/Mvc/Web/Response.php [deleted file]
typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ActionControllerArgumentTest.php
typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ActionControllerTest.php
typo3/sysext/extbase/Tests/Functional/Mvc/Controller/ControllerArgumentsMappingTest.php
typo3/sysext/extbase/Tests/Functional/Mvc/Validation/ActionControllerValidationTest.php
typo3/sysext/extbase/Tests/Unit/Mvc/View/JsonViewTest.php
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Fixture/DummyWebResponse.php [deleted file]
typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/ResponseTest.php [deleted file]
typo3/sysext/fluid/Classes/Core/Widget/AbstractWidgetViewHelper.php
typo3/sysext/fluid/Classes/Core/Widget/WidgetRequestHandler.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/AbstractWidgetViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/Core/Widget/WidgetRequestHandlerTest.php
typo3/sysext/form/Classes/Domain/Finishers/RedirectFinisher.php
typo3/sysext/form/Classes/Domain/Model/FormDefinition.php
typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php
typo3/sysext/form/Classes/ViewHelpers/RenderViewHelper.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/PropertyProtectedMatcher.php

index 60da7c1..fdf3e04 100644 (file)
@@ -14,6 +14,7 @@ The following PHP classes that have been previously deprecated for v10 have been
 - :php:`\TYPO3\CMS\Backend\Template\DocumentTemplate`
 - :php:`\TYPO3\CMS\Extbase\Mvc\Controller\AbstractController`
 - :php:`\TYPO3\CMS\Extbase\Mvc\Web\Request`
+- :php:`\TYPO3\CMS\Extbase\Mvc\Web\Response`
 
 The following PHP interfaces that have been previously deprecated for v10 have been removed:
 
index 45f333b..3e2aacf 100644 (file)
@@ -177,6 +177,14 @@ class Response implements ResponseInterface
      */
     public function shutdown()
     {
+        // @todo: sending http headers has to be done outside this method. This Response class may hold all headers that
+        //        are to be sent, but it must not alter TSFE or send headers directly. Only the surrounding core framework
+        //        is supposed to send http headers.
+        if (($additionalHeaderData = $this->getAdditionalHeaderData()) !== []) {
+            $this->getTypoScriptFrontendController()->additionalHeaderData[] = implode(LF, $additionalHeaderData);
+        }
+        $this->sendHeaders();
+
         $content = $this->getContent();
         $this->setContent('');
         return $content;
index c8409b7..ea3b410 100644 (file)
@@ -16,6 +16,7 @@
 namespace TYPO3\CMS\Extbase\Mvc\Web;
 
 use TYPO3\CMS\Core\Core\Environment;
+use TYPO3\CMS\Extbase\Mvc\Response;
 
 /**
  * A request handler which can handle web requests invoked by the backend.
@@ -26,12 +27,11 @@ class BackendRequestHandler extends AbstractRequestHandler
     /**
      * Handles the web request. The response will automatically be sent to the client.
      *
-     * @return \TYPO3\CMS\Extbase\Mvc\Web\Response
+     * @return Response
      */
     public function handleRequest()
     {
         $request = $this->requestBuilder->build();
-        /** @var \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response */
         $response = $this->objectManager->get(Response::class);
         $this->dispatcher->dispatch($request, $response);
         return $response;
index c8b2ad2..cf149e3 100644 (file)
@@ -16,6 +16,7 @@
 namespace TYPO3\CMS\Extbase\Mvc\Web;
 
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 
 /**
diff --git a/typo3/sysext/extbase/Classes/Mvc/Web/Response.php b/typo3/sysext/extbase/Classes/Mvc/Web/Response.php
deleted file mode 100644 (file)
index df89636..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-namespace TYPO3\CMS\Extbase\Mvc\Web;
-
-use TYPO3\CMS\Core\Compatibility\PublicPropertyDeprecationTrait;
-use TYPO3\CMS\Extbase\Service\EnvironmentService;
-
-/**
- * A web specific response implementation
- * @deprecated since TYPO3 10.2, will be removed in version 11.0.
- */
-class Response extends \TYPO3\CMS\Extbase\Mvc\Response
-{
-    use PublicPropertyDeprecationTrait;
-
-    /**
-     * @var array
-     */
-    private $deprecatedPublicProperties = [
-        'environmentService' => 'Property \TYPO3\CMS\Extbase\Mvc\Web\Response::$environmentService is deprecated since TYPO3 10.2 and will be removed in TYPO3 11.0'
-    ];
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Service\EnvironmentService
-     * @deprecated
-     */
-    private $environmentService;
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService
-     * @internal only to be used within Extbase, not part of TYPO3 Core API.
-     * @deprecated since TYPO3 10.2, will be removed in 11.0
-     */
-    public function injectEnvironmentService(EnvironmentService $environmentService)
-    {
-        $this->environmentService = $environmentService;
-    }
-
-    /**
-     * Sends additional headers and returns the content
-     *
-     * @return string|null
-     * @internal only to be used within Extbase, not part of TYPO3 Core API.
-     */
-    public function shutdown()
-    {
-        if (!empty($this->getAdditionalHeaderData())) {
-            $this->getTypoScriptFrontendController()->additionalHeaderData[] = implode(LF, $this->getAdditionalHeaderData());
-        }
-        $this->sendHeaders();
-        return parent::shutdown();
-    }
-}
index ce00083..b1aa0ef 100644 (file)
@@ -22,8 +22,8 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
 use TYPO3\CMS\Extbase\Mvc\Request;
 use TYPO3\CMS\Extbase\Mvc\RequestInterface;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Mvc\ResponseInterface;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
 use TYPO3\CMS\Extbase\Object\Container\Container;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\Fixture\Controller\ArgumentTestController;
index 071c343..158e0a2 100644 (file)
@@ -19,8 +19,8 @@ namespace TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Request;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Mvc\View\JsonView;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\Fixture\Controller\TestController;
 use TYPO3\CMS\Extbase\Tests\Functional\Mvc\Controller\Fixture\Validation\Validator\CustomValidator;
@@ -39,7 +39,7 @@ class ActionControllerTest extends FunctionalTestCase
     protected $request;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\Response
+     * @var \TYPO3\CMS\Extbase\Mvc\Response
      */
     protected $response;
 
index ad8dd48..93405e6 100644 (file)
@@ -23,7 +23,7 @@ use TYPO3\CMS\Core\Context\LanguageAspect;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
 use TYPO3\CMS\Extbase\Mvc\Request;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
@@ -38,7 +38,7 @@ class ControllerArgumentsMappingTest extends FunctionalTestCase
     protected $request;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\Response
+     * @var \TYPO3\CMS\Extbase\Mvc\Response
      */
     protected $response;
 
index 819239e..d30d801 100644 (file)
@@ -22,7 +22,7 @@ use TYPO3\CMS\Extbase\Error\Error;
 use TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService;
 use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
 use TYPO3\CMS\Extbase\Mvc\Request;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extbase\Security\Cryptography\HashService;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
index ea6ae70..1b5fd4f 100644 (file)
@@ -19,8 +19,8 @@ namespace TYPO3\CMS\Extbase\Tests\Unit\Mvc\View;
 
 use TYPO3\CMS\Core\Utility\StringUtility;
 use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Mvc\View\JsonView;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
 use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
 use TYPO3\CMS\Extbase\Reflection\ReflectionService;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Fixture/DummyWebResponse.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Fixture/DummyWebResponse.php
deleted file mode 100644 (file)
index 09f2886..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Web\Fixture;
-
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
-
-class DummyWebResponse extends Response
-{
-}
diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/ResponseTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/ResponseTest.php
deleted file mode 100644 (file)
index c76ea0c..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-namespace TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Web;
-
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
-use TYPO3\CMS\Extbase\Service\EnvironmentService;
-use TYPO3\CMS\Extbase\Tests\UnitDeprecated\Mvc\Web\Fixture\DummyWebResponse;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-class ResponseTest extends UnitTestCase
-{
-    /**
-     * @var Response
-     */
-    protected $response;
-
-    protected function setUp(): void
-    {
-        parent::setUp();
-
-        $this->response = new DummyWebResponse();
-        $this->response->injectEnvironmentService($this->createMock(EnvironmentService::class));
-    }
-
-    /**
-     * @test
-     */
-    public function privateEnvironmentServiceCanBeAccessedViaMagicGetMethod(): void
-    {
-        self::assertInstanceOf(EnvironmentService::class, $this->response->environmentService);
-    }
-}
index 9ac001a..b824700 100644 (file)
@@ -15,7 +15,7 @@
 
 namespace TYPO3\CMS\Fluid\Core\Widget;
 
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
 use TYPO3\CMS\Extbase\Service\ExtensionService;
 use TYPO3\CMS\Fluid\Core\Widget\Exception\MissingControllerException;
index ca0e499..a4c377b 100644 (file)
@@ -17,9 +17,9 @@ namespace TYPO3\CMS\Fluid\Core\Widget;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Mvc\Web\AbstractRequestHandler;
 use TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
 
 /**
  * Widget request handler, which handles the request if
@@ -80,7 +80,7 @@ class WidgetRequestHandler extends AbstractRequestHandler
     /**
      * Handles the web request. The response will automatically be sent to the client.
      *
-     * @return \TYPO3\CMS\Extbase\Mvc\Web\Response
+     * @return \TYPO3\CMS\Extbase\Mvc\Response
      */
     public function handleRequest()
     {
index fc9d343..b2b4c82 100644 (file)
@@ -19,7 +19,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Widget;
 
 use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
 use TYPO3\CMS\Extbase\Mvc\Request;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
 use TYPO3\CMS\Extbase\Service\ExtensionService;
 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
index 55ba17d..4a9b786 100644 (file)
@@ -18,8 +18,8 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Widget;
 use Prophecy\Argument;
 use TYPO3\CMS\Extbase\Mvc\Dispatcher;
 use TYPO3\CMS\Extbase\Mvc\Request;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Mvc\Web\AbstractRequestHandler;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Fluid\Core\Widget\WidgetRequestBuilder;
 use TYPO3\CMS\Fluid\Core\Widget\WidgetRequestHandler;
index 6fbcd43..e16e439 100644 (file)
@@ -45,7 +45,7 @@ class RedirectFinisher extends AbstractFinisher
     protected $request;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\Response
+     * @var \TYPO3\CMS\Extbase\Mvc\Response
      */
     protected $response;
 
index 10df9f6..8e1aa7d 100644 (file)
@@ -23,7 +23,7 @@ namespace TYPO3\CMS\Form\Domain\Model;
 
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Extbase\Mvc\Request;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
 use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
 use TYPO3\CMS\Form\Domain\Exception\IdentifierNotValidException;
index 7dcace1..6f8b270 100644 (file)
@@ -35,7 +35,7 @@ use TYPO3\CMS\Extbase\Error\Result;
 use TYPO3\CMS\Extbase\Mvc\Controller\Arguments;
 use TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext;
 use TYPO3\CMS\Extbase\Mvc\Request;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
 use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
 use TYPO3\CMS\Extbase\Property\Exception as PropertyException;
@@ -115,7 +115,7 @@ class FormRuntime implements RootRenderableInterface, \ArrayAccess
     protected $request;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\Response
+     * @var \TYPO3\CMS\Extbase\Mvc\Response
      */
     protected $response;
 
index dee1dc3..aaa7879 100644 (file)
@@ -24,7 +24,7 @@ namespace TYPO3\CMS\Form\ViewHelpers;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
-use TYPO3\CMS\Extbase\Mvc\Web\Response;
+use TYPO3\CMS\Extbase\Mvc\Response;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Form\Domain\Factory\ArrayFormFactory;
 use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManagerInterface;
index f003c92..50c8a9c 100644 (file)
@@ -1542,4 +1542,10 @@ return [
             'Breaking-91473-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
+    'TYPO3\CMS\Extbase\Mvc\Web\Response' => [
+        'restFiles' => [
+            'Deprecation-89673-ExtbasesWebRequestAndWebResponse.rst',
+            'Breaking-91473-DeprecatedFunctionalityRemoved.rst'
+        ],
+    ],
 ];
index 7c200e1..30fadf2 100644 (file)
@@ -1254,11 +1254,6 @@ return [
             'Breaking-87511-RemoveViewFormatToObjectNameMapProperty.rst',
         ],
     ],
-    'TYPO3\CMS\Extbase\Mvc\Web\Response->environmentService' => [
-        'restFiles' => [
-            'Deprecation-89468-DeprecateInjectionOfEnvironmentServiceInWebRequest.rst',
-        ],
-    ],
     'TYPO3\CMS\Core\Localization\LanguageService->LL_files_cache' => [
         'restFiles' => [
             'Deprecation-90964-LanguageServiceFunctionalityAndInternalProperties.rst',