rgrove / jsmin-php

:skull: PHP port of Douglas Crockford's JSMin JavaScript minifier. No longer maintained.
423 stars 128 forks source link

bug fix #3

Closed GerHobbelt closed 13 years ago

GerHobbelt commented 13 years ago

fix for bug where JS contains regex(s) with [...] sets, which themselves contain the regex start marker '/', e.g. mootools:

Example: mootools Form.Validator near line 460: return Form.Validator.getValidator('IsEmpty').test(element) || (/^(?:[a-z0-9!#$%&'+/=?^{|}~-].?){0,63}[a-z0-9!#$%&'_+/=?^_{|}~-]@(?:(?:a-z0-9?.)*a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)])$/i).test(element.get('value'));

Also note that another edit syncs the PHP code to the original jsmin.c code (see the diff; it's one if(...) that's augmented that's the important bit there.

Thanks for your excellent work; it's been quite useful!

rgrove commented 13 years ago

I'll definitely take 546bf3b. Thanks!

Have you measured the speedup from d9f1909?

Regarding d9f1909 and a47c82a: my goal with jsmin-php (at least in the main branch) is absolute parity with jsmin.c (even bugs) so that developers can rely on the output from one always matching the output from the other. I may pull these and other original changes into a separate branch though, for the sake of people who want an improved JSMin port.

The .gitignore changes are probably best kept in your own global gitignore config, since they don't pertain to this project specifically.

rgrove commented 13 years ago

Cherry-picked 546bf3b into master and merged the rest into a new "extras" branch. Thanks!