Fix performance issue of parsing big HTML messages by disabling HTML5 parser for these (#7331)

pull/7342/head
Aleksander Machniak 5 years ago
parent 36532345df
commit bf34e8cf9c

@ -39,6 +39,7 @@ CHANGELOG Roundcube Webmail
- Fix characters encoding in group rename input after group creation/rename (#7330)
- Fix bug where some message/rfc822 parts could not be attached on forward (#7323)
- Make install-jsdeps.sh script working without the 'file' program installed (#7325)
- Fix performance issue of parsing big HTML messages by disabling HTML5 parser for these (#7331)
RELEASE 1.4.3
-------------

@ -595,7 +595,11 @@ class rcube_washtml
$method = $this->is_xml ? 'loadXML' : 'loadHTML';
// DOMDocument does not support HTML5, try Masterminds parser if available
if (!$this->is_xml && class_exists('Masterminds\HTML5')) {
if (!$this->is_xml && class_exists('Masterminds\HTML5')
// HTML5 parser is slow with content that contains a lot of tags
// disable it for such cases (https://github.com/Masterminds/html5-php/issues/181)
&& substr_count($html, '<') > 10000
) {
try {
$html5 = new Masterminds\HTML5();
$node = $html5->loadHTML($this->fix_html5($html));

Loading…
Cancel
Save