#104706GeneralUtility::getUrl() does not catch all Guzzle exceptions anymore
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
Reviews 2
History 713
-
Gerrit Code Review pushed patch set 1 for main to change 85733 status
NewUnder Review 08/22/24, 15:36 -
Garvin Hicking changed Duplicated by #104707 08/22/24, 15:49
-
Gerrit Code Review pushed patch set 2 for main to change 85733 08/22/24, 15:49
-
Gerrit Code Review pushed patch set 3 for main to change 85733 08/22/24, 15:55
-
Markus Zipfel commented 08/26/24, 10:07
-
Markus Zipfel changed description 08/27/24, 14:40
-
Garvin Hicking commented 08/27/24, 17:09
@mz_aimcom 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. :)
-
Gerrit Code Review pushed patch set 4 for main to change 85733 08/27/24, 18:39
-
Gerrit Code Review pushed patch set 5 for main to change 85733 08/27/24, 18:40
-
Gerrit Code Review pushed patch set 1 for 12.4 to change 85760 08/27/24, 18:51
-
Anonymous commented and changed status
Under ReviewResolved done0 %100 % 08/27/24, 19:15Applied in changeset commit:567c1b82b3a76c904670ab26d2a3abe54db2623e.
-
Markus Zipfel commented 08/28/24, 13:59
Garvin Hicking wrote in #note-7:
> @mz_aimcom 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. :)ghi Sorry, I wasn't at my workplace anymore, yesterday.🙈 Thanks for your andsbuerk ‘s support. -
Benni Mack changed status
ResolvedClosed 10/15/24, 09:09
@ghi 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:
>
> https://github.com/TYPO3/typo3/blob/b15ef343b9a168dbe88c4cac64550a2bc84b323d/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php#L225
>
> 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`).