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 #1

Updated by Gerrit Code Review almost 2 years 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/+/77777

Actions #2

Updated by Gerrit Code Review almost 2 years ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/77778

Actions #3

Updated by Gerrit Code Review over 1 year 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/+/77777

Actions #4

Updated by Stefan Bürk over 1 year ago

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

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF