Life-V / htmlcompressor

Automatically exported from code.google.com/p/htmlcompressor
Apache License 2.0
0 stars 0 forks source link

php files without ending php tag #66

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you compress a php file that doesn't close the <?php tag, the compresor will 
mess the php code between the last <?php and the end of the file.

I expect that the compresor know that every thing between  <?php and the end of 
the file is php code

I'll try to use an user pattern but It still fails
<\?php[^(\?>)]*$

I know the files I attach don't have html so it's useless to compress them, I I 
choose this ones because this ones are smaller and show the problem.

Original issue reported on code.google.com by anto...@pykiss.com on 16 Dec 2011 at 12:53

Attachments:

GoogleCodeExporter commented 8 years ago
Any other ideas how to rectify this problem? 

I purposely leave out the ending PHP tag ?> in purely PHP files in order to 
save space (granted it's not much but it's a habit now). --preserve-php is 
ignored in this scenario.

PHP comments are also not removed and there seems to be no option to remove 
them, only HTML ones

Thanks

Original comment by u01jmg3 on 19 Apr 2013 at 1:32

GoogleCodeExporter commented 8 years ago
Try this regexp:

(?si)<\?php.+?\?>                                                               
(?si)<\?php.*\Z

Original comment by volny.li...@gmail.com on 28 Jun 2013 at 12:41