Project

General

Profile

Actions

Bug #98175

closed

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

Added by Hannes Bochmann over 1 year 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 #1

Updated by Oliver Hader over 1 year ago

Can you please add the processing instructions for testing? Thx!

Actions #2

Updated by Hannes Bochmann over 1 year ago

Of course.

1. Add the following TypoScript to a page:
lib.parseFunc_RTE.nonTypoTagStdWrap.HTMLparser.tags.img.fixAttrib.src.prefixRelPathWith = /
2. Create a regular text element on a page and add a local image inside a RTE text with a relative link fileadmin/test.jpg
3. Open the FE and a PHP warning (@see description) should pop up.

Actions #3

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

Actions #4

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/+/76466

Actions #5

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

Actions #6

Updated by Benni Mack over 1 year ago

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

Updated by Benni Mack over 1 year ago

  • Related to Bug #99077: TYPO3 11.5.18 regression: Commit 551f540fc3 caused link browser changes to no longer be saved added
Actions #8

Updated by Benni Mack over 1 year ago

  • Related to deleted (Bug #99077: TYPO3 11.5.18 regression: Commit 551f540fc3 caused link browser changes to no longer be saved)
Actions #9

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF