Skip to content

HTML minifier breaks if php comments are joined with php end tag ?> #9806

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
PiimegaOy opened this issue May 31, 2017 · 2 comments
Closed

HTML minifier breaks if php comments are joined with php end tag ?> #9806

PiimegaOy opened this issue May 31, 2017 · 2 comments

Comments

@PiimegaOy
Copy link

Preconditions

  1. tested with 2.1.6 and 2.1.2

Steps to reproduce

  1. add comment like this to any template file
    <?php //This is a test comment?>

  2. In the admin panel enable HTML minification

  3. Switch to production deploy mode (minification is not applied in developer mode)

  4. Check page.

Expected result

  1. The template should work

Actual result

  1. The comment + the ‘?>’ will be removed, i.e template will be broken

The error comes from the file Magento\Framework\View\Template\Html\Minifier where it replaces it on the line 131 (version 2.1.2) in the following pattern

‘#(?<!:|\\\\|\’|“)//(?!\s*\<\!\[)(?!\s*]]\>)[^\n\r]*#‘,

Let me know if you need any more info

@hostep
Copy link
Contributor

hostep commented May 31, 2017

This was already reported: #5316 ;)

@PiimegaOy
Copy link
Author

@hostep Alright thanks, must have missed it.
I'll close this one then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants