Bug #80268
closedHTML Parser: <a> tag may have no "href" attribute
100%
Description
In \TYPO3\CMS\Core\Html\RteHtmlParser::TS_links_db()
<a> tags are parsed and their "href" attributes analysed for URNs. With strict typing introduced with the usage of PHP 7, \TYPO3\CMS\Core\LinkHandling\LinkService::resolve()
now requires the argument it receives to be a string.
However it may happen that the content of the RTE contains <a> tags with no "href" attribute. In my case it happened when pasting content from LibreOffice, which added an empty <a> tag after each <h*> tag. In this case, a PHP error will happen, because the "href" part of the link information is null.
I propose adding a simple check, passing an empty string to the \TYPO3\CMS\Core\LinkHandling\LinkService::resolve()
call if the the "href" information is null.
How to test: prepare some HTML content to paste into the RTE with an empty <a> tag and save the content element.
Updated by Gerrit Code Review over 7 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52038
Updated by Gerrit Code Review over 7 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52038
Updated by Francois Suter over 7 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e4edc72df3fbf531e112919d06c6e965ab206188.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed