Bug #98175
closedOption fixAttrib.[attribute].prefixRelPathWith of HTMLParser throws warning since PHP 8
100%
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.
Updated by Oliver Hader almost 2 years ago
Can you please add the processing instructions for testing? Thx!
Updated by Hannes Bochmann almost 2 years 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.
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/+/76466
Updated by Gerrit Code Review almost 2 years 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
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/+/76493
Updated by Benni Mack almost 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 98cc2384ddc06e8d80a6ce30afa237b2d5b1fab1.
Updated by Benni Mack almost 2 years ago
- Related to Bug #99077: TYPO3 11.5.18 regression: Commit 551f540fc3 caused link browser changes to no longer be saved added
Updated by Benni Mack almost 2 years ago
- Related to deleted (Bug #99077: TYPO3 11.5.18 regression: Commit 551f540fc3 caused link browser changes to no longer be saved)