[BUGFIX] Explicitly cast variable to string 45/61345/4
authorAlexander Schnitzler <git@alexanderschnitzler.de>
Wed, 24 Jul 2019 07:51:40 +0000 (09:51 +0200)
committerBenni Mack <benni@typo3.org>
Mon, 29 Jul 2019 18:47:26 +0000 (20:47 +0200)
Class \TYPO3\CMS\Extbase\Core\Bootstrap calls method
\TYPO3\CMS\Extbase\Mvc\ResponseInterface::shutdown()
which does not declare a strict return type yet.

Thus, it's possible that the returned value is not
of type string which then violates the return type
promise of method handleRequest() of the Bootstrap
class.

Therefore, the return value is explicitly casted
to string.

Releases: master
Resolves: #88829
Change-Id: Ibea2451e87c5c66070e5ce4ed5f30c408b7412cd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61345
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Armin Vieweg <armin@v.ieweg.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/extbase/Classes/Core/Bootstrap.php

index 46a6b24..9c53b5d 100644 (file)
@@ -185,7 +185,13 @@ class Bootstrap implements \TYPO3\CMS\Extbase\Core\BootstrapInterface
         if ($response === null) {
             $content = '';
         } else {
-            $content = $response->shutdown();
+            /*
+             * Explicitly cast $content to string here as \TYPO3\CMS\Extbase\Mvc\ResponseInterface::shutdown does not
+             * use strict types yet and response objects possibly return other types than string.
+             *
+             * todo: remove the type cast when \TYPO3\CMS\Extbase\Mvc\ResponseInterface declares strict return types.
+             */
+            $content = (string)$response->shutdown();
             $this->resetSingletons();
             $this->cacheService->clearCachesOfRegisteredPageIds();
         }