Project

General

Profile

Actions

Bug #98175

closed

Option fixAttrib.[attribute].prefixRelPathWith of HTMLParser throws warning since PHP 8

Added by Hannes Bochmann almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2022-08-19
Due date:
% Done:

100%

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

Description

If fixAttrib.[attribute].prefixRelPathWith is configured for let's say a image, there might be a warning like " PHP Warning: Undefined array key "scheme" in .../typo3/sysext/core/Classes/Html/HtmlParser.php line 574 "

If you look at the code it's obvious.

if ($params['prefixRelPathWith'] ?? false) {
    $urlParts = parse_url($tagAttrib[0][$attr]);
    if (!$urlParts['scheme'] && $urlParts['path'][0] !== '/') {
        // If it is NOT an absolute URL (by http: or starting "/")
        $tagAttrib[0][$attr] = $params['prefixRelPathWith'] . $tagAttrib[0][$attr];
    }
}

If prefixRelPathWith is set the given URL will likely be a local one without a scheme leading to said warning.

Actions

Also available in: Atom PDF