How to resolve the notice of Deprecated with PHP 7
-
If you have PHP 7, Simple Footnotes will throw a PHP notice of Deprecated:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; nacin_footnotes has a deprecated constructor in /path/to/wp-content/plugins/simple-footnotes/simple-footnotes.php on line 10
The E_DEPRECATED is emitted for the reason explained in this page: https://www.php.net/manual/en/migration70.deprecated.php#migration70.deprecated.php4-constructors.
Since the plugin has not been updated for 4 years, I edited it in this way:
Line 15
Change this line from this:
function nacin_footnotes() {
to this:
function __construct() {
Notice that
__
is a double underscore.Line 26
After line 26 (i.e., create a newline), add these lines:
function nacin_footnotes() { self::__construct(); }
Save the file and you should not receive notices anymore.
To be clear, here you can find the diff between the original file and the modified: https://gist.github.com/aldolat/9642e5614449753f9408bd256136b4da/revisions
- The topic ‘How to resolve the notice of Deprecated with PHP 7’ is closed to new replies.