Project

General

Profile

Actions

Bug #104706

closed

GeneralUtility::getUrl() does not catch all Guzzle exceptions anymore

Added by Markus Zipfel 3 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
Start date:
2024-08-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.3
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

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


Related issues 1 (0 open1 closed)

Has duplicate TYPO3 Core - Task #104707: [BUGFIX] Also catch Guzzle `ConnectException` in `GeneralUtility::getUrl()`Rejected2024-08-22

Actions
Actions #1

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

Actions #2

Updated by Garvin Hicking 3 months ago

  • Has duplicate Task #104707: [BUGFIX] Also catch Guzzle `ConnectException` in `GeneralUtility::getUrl()` added
Actions #3

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

Actions #4

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

Actions #5

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:

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`).

Actions #6

Updated by Markus Zipfel 3 months ago

  • Description updated (diff)
Actions #7

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. :)

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

Updated by Anonymous 3 months ago

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

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.

Actions #13

Updated by Benni Mack about 1 month ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF