Project

General

Profile

Actions

Bug #80268

closed

HTML Parser: <a> tag may have no "href" attribute

Added by Francois Suter about 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
Start date:
2017-03-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.0
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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.

Actions #1

Updated by Gerrit Code Review about 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

Actions #2

Updated by Gerrit Code Review about 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

Actions #3

Updated by Francois Suter about 7 years ago

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

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF