Plugin

Developer
Supported

GWcode Categories

ExpressionEngine 1.x, ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Leon Dijk

     

You must be logged in to post.

Redefining already defined constructor

Bug Report

Elliot Lewis
Elliot Lewis

In PHP Strict mode I’m getting the error:

Redefining already defined constructor for class Gwcode_categories […] line 55

Your plugin has 2 ways to define the constructor so I just commented out the (old?) way.

I can’t remember if this was EE1s way of defining the constructor, but it’s been in EE2s docs since 2.5 (oldest I can go back).

// public function Gwcode_categories() {
//  $this->__construct();
// }

 
public function __construct() 
Mark Croxton
# 1
Mark Croxton

Just ran in to this too.

5BYFIVE
# 2
5BYFIVE

I just ran into this as well, is the above fix ok to use? Any issues since? Thanks!

ChrisOConnor
# 3
ChrisOConnor

For anyone coming upon this, I got this with PHP 5.6 in EE 2.11.6

Do the “function usage()” to “public static function usage()” as you’ve seen in other posts made this error also go away on most pages.

Commenting that out fixed it anywhere else it popped up.  Thanks, would have taken forever to figure out.

lehrerfreund
# 4
lehrerfreund

Thanks, worked for me, too.

If you want to understand why, read about constructors in php5.

BTW you will read there, that

Old style constructors are DEPRECATED in PHP 7.0, and will be removed in a future version. You should always use __construct() in new code.