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

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: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used 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

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.