Project

General

Profile

Actions

Bug #99863

closed

PHP 8.1 issues with linkvalidator

Added by Ralph Brugger almost 2 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Linkvalidator
Target version:
-
Start date:
2023-02-07
Due date:
% Done:

100%

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

Description

We have two issues within the likvalidator when checking https://www.emas.de
`GET https://www.emas.de` resulted in a `403 Forbidden` response:

1. issue

PHP Warning: Undefined array key "exception" in
typo3_src-11.5.21/typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php
line 316

public function getErrorMessage($errorParams)
default:
    $message = sprintf($lang->getLL('list.report.otherhttpcode'), $errorType, $errorParams['exception']);

could / should bei changed into:

$errorHint = '';
if(isset($errorParams['message'])){
     $errorHint = $errorParams['message'];
}
$message = sprintf($lang->getLL('list.report.otherhttpcode'), $errorType, $errorHint);

2. issue

PHP Warning: Trying to access array offset on value of type bool in
typo3_src-11.5.21/typo3/sysext/linkvalidator/Classes/Report/LinkValidatorReport.php line 578

protected function renderTableRow($table, array $row)
$response = $row['url_response'];
if ($response['valid']) {
    $linkMessage = '<span class="text-success">' . htmlspecialchars($languageService->getLL('list.msg.ok')) . '</span>';
} else {
    $linkMessage = '<span class="text-danger">'
        . nl2br(
            // Encode for output
            htmlspecialchars(
                $hookObj->getErrorMessage($response['errorParams']),
                ENT_QUOTES,
                'UTF-8',
                false
            )
        )
        . '</span>';
}
if ($response && $response['valid']) {
    $linkMessage = '<span class="text-success">' . htmlspecialchars($languageService->getLL('list.msg.ok')) . '</span>';
} elseif($response && isset($response['errorParams'])) {
    $linkMessage = '<span class="text-danger">'
        . nl2br(
            // Encode for output
            htmlspecialchars(
                $hookObj->getErrorMessage($response['errorParams']),
                ENT_QUOTES,
                'UTF-8',
                false
            )
        )
        . '</span>';
}else{
      $linkMessage = '<span class="text-danger">Invalid response</span>';
}
Actions

Also available in: Atom PDF