Project

General

Profile

Actions

Bug #84171

closed

\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl() Request-Header format changed from array of strings to associative array in GuzzleHttp conversion

Added by Felix Buenemann about 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2018-03-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Yes
Sprint Focus:

Description

In TYPO3 8 the cURL based implementation \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl() was replaced with GuzzleHttp in #70056.

This introduced a breaking change in how http headers are passed.

In the old implementation HTTP request headers where passed as an array of strings:

$url = 'https://typo3.org';
$requestHeaders = ['Accept: application/json', 'X-Foo: Bar', 'X-Foo: Baz'];
GeneralUtility::getUrl($url, 0, $requestHeaders);

In the new implementation the $requestHeaders are passed through to guzzle as part of the headers option, which wants the following format:

$url = 'https://typo3.org';
$requestHeaders = ['Accept' => 'application/json', 'X-Foo' => ['Bar', 'Baz']];
GeneralUtility::getUrl($url, 0, $requestHeaders);

Due to the different format code that uses GeneralUtility::getUrl() and requires request headers breaks when upgrading from TYPO3 7 to 8 or 9.

I think this is a bug and not an intentional change, since all the changes made as part of #70056 try to emulate the old cURL behavior of getUrl().


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #70056: Use guzzleClosedGeorg Ringer2015-09-23

Actions
Actions #1

Updated by Felix Buenemann about 6 years ago

Actions #2

Updated by Felix Buenemann about 6 years ago

  • Is Regression set to Yes
Actions #3

Updated by Wouter Wolters about 6 years ago

This breaking change is IMO intentional because that is the new format the Guzzle RequestFactory uses. The new implementation is described in the RST file in the patch how to use the new headers.

Actions #4

Updated by Gerrit Code Review about 6 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046

Actions #5

Updated by Felix Buenemann about 6 years ago

I proposed a change in Gerrit that restores compatibility with the old style without breaking the new style.

Actions #6

Updated by Gerrit Code Review about 6 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046

Actions #7

Updated by Felix Buenemann about 6 years ago

Wouter Wolters: The bad thing is that this currently breaks code silently, no exception is thrown for code that uses the old list of headers format, but the headers will not be sent.

For example I was using it to do conditional GET requests with an If-None-Match Header and after upgrading to 8.7 ist startet always fetching the full response, because the header was not correctly added.

So it would be great if someone could take a look at my Gerrit change that adds backwards compatibility.

Actions #8

Updated by Gerrit Code Review about 6 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046

Actions #9

Updated by Gerrit Code Review about 6 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046

Actions #10

Updated by Gerrit Code Review about 6 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046

Actions #11

Updated by Gerrit Code Review about 6 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56046

Actions #12

Updated by Gerrit Code Review about 6 years ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56149

Actions #13

Updated by Felix Buenemann about 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #14

Updated by Gerrit Code Review about 6 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56149

Actions #15

Updated by Felix Buenemann about 6 years ago

  • Status changed from Under Review to Resolved
Actions #16

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF