[BUGFIX] Change getUrl() $report['content_type'] to string 43/56043/3
authorFelix Buenemann <felix.buenemann@gmail.com>
Thu, 8 Mar 2018 08:18:34 +0000 (09:18 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 8 Mar 2018 10:46:21 +0000 (11:46 +0100)
In the conversion of \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl()
from cURL to GuzzleHttp the type of the $report['content_type'] field
was changed from a string to an array of strings.

This changes the field back to a string.

Also updated ErrorController getUrl test double to reflect the changes.

Resolves: #84173
Related: #84167
Releases: master, 8.7
Change-Id: Ia0eb60c42e920d66ce63afd0bd659c4b56d6d05b
Reviewed-on: https://review.typo3.org/56043
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/frontend/Tests/Unit/Controller/ErrorControllerTest.php

index ebeb1b1..673cf5a 100644 (file)
@@ -1846,7 +1846,7 @@ class GeneralUtility
                 $report['lib'] = 'http';
                 if ($response->getStatusCode() >= 300 && $response->getStatusCode() < 400) {
                     $report['http_code'] = $response->getStatusCode();
-                    $report['content_type'] = $response->getHeader('Content-Type');
+                    $report['content_type'] = $response->getHeaderLine('Content-Type');
                     $report['error'] = $response->getStatusCode();
                     $report['message'] = $response->getReasonPhrase();
                 } elseif (empty($content)) {
@@ -1855,7 +1855,7 @@ class GeneralUtility
                 } elseif ($includeHeader) {
                     // Set only for $includeHeader to work exactly like PHP variant
                     $report['http_code'] = $response->getStatusCode();
-                    $report['content_type'] = $response->getHeader('Content-Type');
+                    $report['content_type'] = $response->getHeaderLine('Content-Type');
                 }
             }
         } else {
index 7c05fca..793fb35 100644 (file)
@@ -501,7 +501,7 @@ X-TYPO3-Additional-Header: Banana Stand';
         $prefixPageResponseProphecy->getHeaders()->willReturn([]);
         $prefixPageResponseProphecy->getBody()->willReturn($streamProphecy);
         $prefixPageResponseProphecy->getStatusCode()->willReturn(200);
-        $prefixPageResponseProphecy->getHeader('Content-Type')->willReturn(['text/html; charset=utf-8']);
+        $prefixPageResponseProphecy->getHeaderLine('Content-Type')->willReturn('text/html; charset=utf-8');
         $requestFactoryProphecy = $this->prophesize(RequestFactory::class);
         $requestFactoryProphecy->request(Argument::cetera())->willReturn($prefixPageResponseProphecy->reveal());
         GeneralUtility::addInstance(RequestFactory::class, $requestFactoryProphecy->reveal());