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.