Skip to content

Commit

Permalink
[BUGFIX] Treat empty responses as error in GeneralUtility::getUrl
Browse files Browse the repository at this point in the history
This fixes a negation bug introduced when the GeneralUtility::getUrl
code was converted to use GuzzleHttp instead of cURL.

Also updated ErrorController test doubles that where asserting the
wrong behavior.

Resolves: #84167
Releases: master, 8.7
Change-Id: I9b8982dc34f8a4ac22769beb7f837f090ce73f23
Reviewed-on: https://review.typo3.org/56039
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
  • Loading branch information
felixbuenemann authored and lolli42 committed Mar 8, 2018
1 parent 3daaf6c commit 2bba5cc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Utility/GeneralUtility.php
Expand Up @@ -1849,7 +1849,7 @@ public static function getUrl($url, $includeHeader = 0, $requestHeaders = null,
$report['content_type'] = $response->getHeader('Content-Type');
$report['error'] = $response->getStatusCode();
$report['message'] = $response->getReasonPhrase();
} elseif (!empty($content)) {
} elseif (empty($content)) {
$report['error'] = $response->getStatusCode();
$report['message'] = $response->getReasonPhrase();
} elseif ($includeHeader) {
Expand Down
Expand Up @@ -501,7 +501,7 @@ private function prophesizeGetUrl(): void
$prefixPageResponseProphecy->getHeaders()->willReturn([]);
$prefixPageResponseProphecy->getBody()->willReturn($streamProphecy);
$prefixPageResponseProphecy->getStatusCode()->willReturn(200);
$prefixPageResponseProphecy->getReasonPhrase()->willReturn('OK');
$prefixPageResponseProphecy->getHeader('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());
Expand Down

0 comments on commit 2bba5cc

Please sign in to comment.