keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

doctype checking too strict #250

Closed nosilver4u closed 3 years ago

nosilver4u commented 3 years ago

Just ran into an issue with the is_cacheable() method and a slightly non-standard doctype: <!doctype html > The existing check doesn't pass because of the space between html and the closing bracket, this regex fixes it: /^<!DOCTYPE.+html\s*>/i The existing regex is at https://github.com/keycdn/cache-enabler/blob/6ce1426fb53ae942f7c4cd8e96a74da6413e5fba/inc/cache_enabler_engine.class.php#L234

coreykn commented 3 years ago

You're right. This behavior was initially added in PR #137. Even though it is not a standard doctype, updating that regular expression to allow 0 or more whitespace characters in that location is okay by me. If you'd like, you can open a PR to close this issue. Otherwise, I can get something added at the beginning of next week.