Unhandled Exception : Redefining already defined constructor for class-Collection of common programming errors

In PHP, I get the following error :

Redefining already defined constructor for class Select

That’s because A class ‘Select’ has a ‘select’ function (in addition to its constructor). But unlike the other topics about this error, my error is an ‘Unhandled Exception’.

The error does not shows up in my local server where the error reporting level is 30719 (wamp, PHP 5.3.9, Apache 2.2.21). In my prod server where the error is displayed, the error reporting level is 22527 (real server, Ubuntu, PHP 5.3.2, Apache 2.2.14) .

Why the error does shows up as an Unhandled exception for me ? I use the Laravel framework but the error does not even go away if I modify laravel/laravel.php to manually set error_reporting(0), and ini_set('display_error', 0) in start.php ????

What can I do ? Many thanks

  1. For backwards compatibility purposes, PHP utilizes methods with the same name as the class as class constructors. So by the fact you have a method named the same as the class as well as a constructor, you are getting this exception. You should change your method name or class name.