PHP7 Compatibility EASY FIX use __construct()
-
Hi, there’s a small but important bug in your code as interepreted by PHP7:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; mailchimpSF_Widget has a deprecated constructor in /SITE/wp-content/plugins/mailchimp/mailchimp_widget.php on line 473
All you need to do to fix it is use
__construct()
rather than the class name in the constructor function for your classes:class mailchimpSF_Widget extends WP_Widget { // function mailchimpSF_Widget() { function __construct() {
WordPress already uses this format throughout the codebase, so it’s a safe bet. PHP7 is going to skyrocket in popularity soon so please fix this ASAP to avoid it being a hassle for other users. The deprecation notice shows/is-generated on all pages across the site, so it’s extremely noisy.
Thanks!
- The topic ‘PHP7 Compatibility EASY FIX use __construct()’ is closed to new replies.