voku / HtmlMin

:clamp: HtmlMin: HTML Compressor and Minifier via PHP
MIT License
161 stars 22 forks source link

More issues with <code> and <p> #63

Closed ozupey closed 2 years ago

ozupey commented 3 years ago

What is this feature about (expected vs actual behaviour)?

This seemingly basic HTML results in some very weird output:

<p><html-min--voku--saved-content data-html-min--voku--saved-content="0"></html-min--voku--saved-content></p>

<p>
    </p>
    <h3>Vestibulum eget velit arcu.</h3>
   
    Vestibulum eget velit arcu. Phasellus eget scelerisque dui, nec elementum ante. <code>aoaoaoao</code>

Namely:

  1. The content in the first <p> has been replaced with some internal code.
  2. The second <p> has been instantly closed leaving the content below missing a parent.
  3. None of the whitespace is removed.

How can I reproduce it?

<?php
use voku\helper\HtmlMin;

$html = '
<p>
    foo <code>bar</code>. ZIiiii  zzz <code>1.1</code> Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>

<p>
    <h3>Vestibulum eget velit arcu.</h3>

    Vestibulum eget velit arcu. Phasellus eget scelerisque dui, nec elementum ante. <code>aoaoaoao</code>
</p>
';

$htmlMin = new voku\helper\HtmlMin();

echo $htmlMin->minify($html); 

Does it take minutes, hours or days to fix?

No clue, hopefully minutes. :)

Any additional information?

voku/html-min 4.4.8 HTML Compressor and Minifier voku/simple_html_dom 4.7.29 Simple HTML DOM package.

voku commented 2 years ago

Fixed in version 4.4.10.