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

Prevent undefined variable notices regarding $wp_config_file #210

Closed stevegrunwell closed 3 years ago

stevegrunwell commented 3 years ago

Cache_Enabler_Disk::set_wp_cache_constant() checks two locations for a valid wp-config.php file, but if neither ABSPATH . '/wp-config.php' nor dirname(ABSPATH) . '/wp-config.php' exist, the is_writable() check will cause an "Undefined variable" notice.

This PR adds a default value of false and will return early if the variable either uses this default or represents a non-writable file.