wpsharks / comet-cache

An advanced WordPress® caching plugin inspired by simplicity.
https://cometcache.com
GNU General Public License v3.0
77 stars 18 forks source link

create_function() is deprecated in PHP 7.2 #921

Open raamdev opened 6 years ago

raamdev commented 6 years ago

Seen with WP4.9.1 running on a PHP7.2.0 server: PHP Deprecated: Function create_function() is deprecated in …\wp-content\plugins\comet-cache\src\includes\traits\Shared\FsUtils.php on line 33

Reported here: https://wordpress.org/support/topic/version-170220-function-create_function-is-deprecated-in-php-7-2/

jaswrks commented 6 years ago

Looks like all of these could now be updated. We can use Closures instead of create_function() now that we have a 5.3 minimum. http://php.net/manual/en/migration53.new-features.php

raamdev commented 6 years ago

It looks like we actually don't want to use Closures in plugin.php, since the code in that file where we use create_function() is code designed to show error notices for users running PHP < v5.4, which means using Closures there would actually break that code and not do what it's supposed to do (show a message when a user tries to run Comet Cache with PHP < 5.4).