Bug #104706
closedGeneralUtility::getUrl() does not catch all Guzzle exceptions anymore
100%
Description
In getUrl()
only a \GuzzleHttp\Exception\RequestException
is catched. This piece of code exists since April 20, 2016.
At that time ConnectException
and RequestException
were not yet separated in Guzzle. But that changed in January 2020 and since then, they both extend TransferException
.
So I think that GeneralUtility::getUrl()
should catch \GuzzleHttp\Exception\TransferException
.
See also: https://github.com/guzzle/guzzle/blob/7.9.2/UPGRADING.md?plain=1#L22
Updated by Gerrit Code Review 3 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85733
Updated by Garvin Hicking 3 months ago
- Has duplicate Task #104707: [BUGFIX] Also catch Guzzle `ConnectException` in `GeneralUtility::getUrl()` added
Updated by Gerrit Code Review 3 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85733
Updated by Gerrit Code Review 3 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85733
Updated by Markus Zipfel 3 months ago
@Garvin Hicking Thanks for the description update and your other admin work.👍
You asked some questions at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85733?tab=comments. I'm not sure if I am meant to anwer, but I will try to do so:
(Also, should this be backported to v12?)
Yes, absolutely. (In my option.) I could also provide a pull request for that if you like.
Maybe you could also look at:
where this could probably now be unified, too?
Yes, that is possible. Since the catch statement is `catch (RequestException | ConnectException $e)`, we could also write it as `catch (TransferException $e)`. But when looking at the following lines with the comment that explains the two types, I am not sure if that will improve the code.
If I understnad correctly, https://github.com/TYPO3/typo3/blob/5043d3cb4d6e3069dd1a5cd4c25c9802dad855fd/typo3/sysext/core/Tests/Unit/Http/ClientTest.php#L23 does not need adoption for the tests?
No, there are already two test cases (lines 80 and 94) for the two types of Guzzle Exceptions (`RequestException` and `ConnectException`).
Updated by Garvin Hicking 3 months ago
@Markus Zipfel Yes, thanks for the reply - if you have your gerrit account you're welcome to do the code review/comments in there.
You can just add "12.4" to the existing patchset, no need for a seperate backport PR. And if you could enhance that one other exception place, that would be awesome. :)
Updated by Gerrit Code Review 3 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85733
Updated by Gerrit Code Review 3 months ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85733
Updated by Gerrit Code Review 3 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/85760
Updated by Anonymous 3 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 567c1b82b3a76c904670ab26d2a3abe54db2623e.
Updated by Markus Zipfel 3 months ago
Garvin Hicking wrote in #note-7:
@Markus Zipfel Yes, thanks for the reply - if you have your gerrit account you're welcome to do the code review/comments in there.
You can just add "12.4" to the existing patchset, no need for a seperate backport PR. And if you could enhance that one other exception place, that would be awesome. :)
@Garvin Hicking Sorry, I wasn't at my workplace anymore, yesterday.🙈 Thanks for your and @Stefan Bürk 's support.