tijsverkoyen / CssToInlineStyles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.
BSD 3-Clause "New" or "Revised" License
5.8k stars 187 forks source link

Use possessive quantifiers to avoid reaching PCRE limits #146

Closed stof closed 8 years ago

stof commented 8 years ago

On big CSS files, the regex deleting media queries was reaching the pcre jit stack limit, breaking the library on PHP 7 by default (as pcre.jit is enabled by default).

Note that this could also reach the PCRE backtracking limit in non-JIT mode (so both on 5.x and 7.x), but this would require a file much bigger than the one I added in the testsuite (because PHP configures the PCRE backtrack limit to 1000000 by default, but it would fail on this big file when setting it to 1000 without my patch, while it works with the patch)

stof commented 8 years ago

@tijsverkoyen anything blocking this PR ? It fixes an annoying bug, which happens much more frequently on PHP 7

Stadly commented 8 years ago

Please merge this fix! I was about to issue a pull request doing the exact same thing.

tijsverkoyen commented 8 years ago

Dudes, really... I only have limited time. @stof are you interested in becoming a collaborator?

stof commented 8 years ago

@tijsverkoyen yeah, I could. I already have lots of projects, but I'm using this one at work, so I can dedicate some work time to it from times to times (this is how I sent this bunch of PRs for instance, when migrating our prod to PHP 7)