voku / HtmlMin

:clamp: HtmlMin: HTML Compressor and Minifier via PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HtmlMin cut html at the end of page

Fantella1978 opened this issue · comments

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

HtmlMin cut html code at the end of html page

How can I reproduce it?

Example page without use HtmlMin:
https://sector.biz.ua/docs/tiworker_exe_bitcoin_miner_riched32_dll/page-no-htmlmin.phtml

Example page with HtmlMin:
https://sector.biz.ua/docs/tiworker_exe_bitcoin_miner_riched32_dll/page-with-htmlmin.phtml

see difference in pagesources

Does it take minutes, hours or days to fix?

i don't know

Any additional information?

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

Fixed in version 4.4.6

Thanks for the bug report. 👍

Sorry, but not fixed yet.

My test with invalid html passed? 🤔 Can you give me a small example of the problem, so that I can use it as test-case? Thanks.

that's the problem is that the example should be a big :)

Try minify this html:

view-source:https://sector.biz.ua/docs/tiworker_exe_bitcoin_miner_riched32_dll/page-no-htmlmin.phtml

Maybe it will help, but cropped on after the 248th tag <wbr>. It seems to me that somewhere there is some kind of boundary in 256, maybe.

The error was that php DOMDocument tries to close the <wbr> tags with </wbr> ... so now we will re-write the self-closing tags to e.g. <wbr/>.

Please try version 4.4.7

Tested the version 4.4.7

HtmlMin dont't cut html code :) It's good! BUT, in minified html disappeared tags: <head>, </head>, </body>, </html>.
It's no good!

input:
<!-- === BEGIN TOP === -->
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html prefix="og: http://ogp.me/ns#" lang="ru">
<!--<![endif]-->
<head>
<!-- Title -->
<title>......

output:
<html><body> <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> <!--[if !IE]><!--> <!--<![endif]--> <title>.......

As a result, there are errors in checking html: https://validator.w3.org/nu/?doc=https%3A%2F%2Fsector.biz.ua%2Fdocs%2Ftiworker_exe_bitcoin_miner_riched32_dll%2Fpage-with-htmlmin.phtml

👍

The problem was that DOMDocument from php cannot handle the input if there are content before the doctype, so we now remove it and it's working as expected. Fixed in version 4.4.8.

Tested version 4.4.8.

Disappeared tags: </head>, </body>, </html>. Validator as a result of verification does not find errors.

Well, then we close the issue.