JComments errors in PHP 7: plgContentJComments and JCommentsACL

What?
During a site upgrade, the commenting extension for Joomla called JComments would return errors when using PHP version 7. This is a quick article to document what needed doing to fix the errors.

How?
First some errors:

ERROR: plgContentJComments
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgContentJComments has a deprecated constructor in /plugins/content/jcomments/jcomments.php on line 25
Fix:
copyraw
// change on line 27
function plgContentJComments(&$subject, $config)
// to
function __construct(&$subject, $config)
  1.  // change on line 27 
  2.  function plgContentJComments(&$subject, $config) 
  3.  // to 
  4.  function __construct(&$subject, $config) 

ERROR: JCommentsACL
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; JCommentsACL has a deprecated constructor in /components/com_jcomments/classes/acl.php on line 17
Fix:
copyraw
// change on line 41
function JCommentsACL()
// to
function __construct()
  1.  // change on line 41 
  2.  function JCommentsACL() 
  3.  // to 
  4.  function __construct() 

ERROR: JCommentsSubscriptionManager
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; JCommentsSubscriptionManager has a deprecated constructor in /components/com_jcomments//jcomments.subscription.php on line 14
Fix:
copyraw
// change on line 23
function JCommentsSubscriptionManager()
// to
function __construct()
  1.  // change on line 23 
  2.  function JCommentsSubscriptionManager() 
  3.  // to 
  4.  function __construct() 
Category: Joomla :: Article: 710

Add comment

Your rating:

Submit

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Please publish modules in offcanvas position.