Bug #85067

Uncaught Exception in Linkvalidator at 'Too many redirects' link

Added by Loek Hilgersom over 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Category:
Linkvalidator
Target version:
Start date:
2018-05-23
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

An uncaugt exception occurs when Linkvalidator encounters an external link which doesn't redirect properly (the page is stuck in a redirect loop, browser says 'The page isn’t redirecting properly').

Also, if the exception would be solved, this type of link would not be reported as a broken link!

The exception is thrown because $e->getResponse() returns NULL, therefor getStatusCode() can not be called.

I made a workaround by replacing the lines starting at line 88 in ExternalLinktype->checkLink with this:

        } catch (TooManyRedirectsException $e) {
            $isValidUrl = false;
            $lastRequest = $e->getRequest();
            $response = $e->getResponse();
            $errorParams['errorType'] = 'loop';
            $errorParams['location'] = (string)$lastRequest->getUri();
            if ($response === null) {
                $errorParams['errorCode'] = '301';
            } else {
                $errorParams['errorCode'] = $response->getStatusCode();
            }
#1

Updated by Sybille Peters over 2 years ago

  • Assignee set to Sybille Peters
#2

Updated by Sybille Peters over 2 years ago

  • Priority changed from Should have to Must have
#3

Updated by Sybille Peters over 2 years ago

Should always check for hasResponse() before getReponse(), see also http://docs.guzzlephp.org/en/stable/quickstart.html#exceptions

#4

Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

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/57011

#5

Updated by Gerrit Code Review over 2 years ago

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

#6

Updated by Gerrit Code Review over 2 years ago

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

#7

Updated by Gerrit Code Review over 2 years ago

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

#8

Updated by Gerrit Code Review over 2 years ago

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

#9

Updated by Cristian Buja over 2 years ago

This bug is also present in version 8.7

#10

Updated by Sybille Peters over 2 years ago

  • Parent task set to #85006
#11

Updated by Sybille Peters over 2 years ago

  • Target version set to next-patchlevel
#12

Updated by Gerrit Code Review over 2 years ago

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

#13

Updated by Gerrit Code Review over 2 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/57356

#14

Updated by Sybille Peters over 2 years ago

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

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed
#16

Updated by Sybille Peters about 1 year ago

  • Parent task deleted (#85006)

Also available in: Atom PDF