Project

General

Profile

Actions

Bug #85067

closed

Uncaught Exception in Linkvalidator at 'Too many redirects' link

Added by Loek Hilgersom almost 6 years ago. Updated over 4 years 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();
            }
Actions

Also available in: Atom PDF