phpjoomlak2

PHP Deprecated errors


[22-Apr-2018 17:36:22 Europe/London] PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; plgK2FbComments_K2 has a deprecated constructor in `/home/dailydealsblogco/public_html/plugins/k2/fbcomments_k2/fbcomments_k2.php on line 16`

Here's line 16:

class plgK2FbComments_K2 extends K2Plugin {
var $pluginName = 'fbcomments_k2';
var $pluginNameHumanReadable = 'DISQUS for K2 plugin';

public function plgK2FbComments_K2(& $subject, $params) {
    parent::__construct($subject, $params);
    // JPlugin::loadLanguage('plg_k2_fbcomments_k2');
}

Could anyone help me with the change? Been Googling for hours and still none the wiser. I'd like to get rid of the errors from it.


Solution

  • Rename the constructor function to __construct:

    public function __construct(& $subject, $params) {
        parent::__construct($subject, $params);
        // JPlugin::loadLanguage('plg_k2_fbcomments_k2');
    }