This error is thrown in PHP 5.4.3, and the solutions I have found was to hide the errors.
error_reporting(E_ALL ^ E_STRICT);
But I want to fix it, not hide it. Could you explain why this error is thrown and how to fix it?
This is the error:
Strict Standards: Redefining already defined constructor for class VisanaObject in /home/template/public_HTML/project/activecollab/angie/classes/VisanaObject.class.php on line 33
This is the code of the class:
class VisanaObject {
/**
* Object constructor
*
* @param void
* @return Object
*/
function VisanaObject() {
$args = func_get_args();
// Call constructor, with or without args
if(is_array($args)) {
call_user_func_array(array(&$this, '__construct'), $args);
} else {
$this->__construct();
} // if
} // VisanaObject
/**
* Construct the VisanaObject
*
* @param void
* @return VisanaObject
*/
function __construct() {
} // __construct
} // VisanaObject
It's a PHP throwback. PHP used the class name as the constructor method, and didn't have a formal __construct()
magic method. Now there is __construct, but the "class name as function = constructor" is kept for backwards compatibility.
So you have
class foo {
function foo() { ... this is a constructor }
function __construct() { .. this is another constructor ... }
}
Rename your VisanaObject
method, or move its code into __construct()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With