note 113380 added to language.oop5.decon
| From: | kitchin | Date: | Thu, 03 Oct 2013 22:36:43 +0000 |
| Subject: | note 113380 added to language.oop5.decon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196460@lists.php.net to get a copy of this message | ||
If your code has a redundant constructor for PHP 4 compatibility, an E_STRICT error may be raised in
PHP 5.x:
Strict Standards: Redefining already defined constructor for class...
What is a redundant constructor for PHP 4 compatibility? It looks like
<?php
Class Foo {
function Foo() {
return $this->__construct();
}
function __construct() {
// whatever
}
?>
If you don't need PHP 4, just delete the Foo function. Or you reverse the order of Foo and
__construct, the error goes away, so that's probably OK for a single class. Also there was a
suggestion to do this in Foo:
<?php
function Foo() {
if (version_compare(PHP_VERSION,"5.0.0","<")) {
return $this->__construct();
}
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 76.6.215.126
----
Manual Page -- http://php.net/manual/en/language.oop5.decon.php
Edit -- https://master.php.net/note/edit/113380
Del: integrated -- https://master.php.net/note/delete/113380/integrated
Del: useless -- https://master.php.net/note/delete/113380/useless
Del: bad code -- https://master.php.net/note/delete/113380/bad+code
Del: spam -- https://master.php.net/note/delete/113380/spam
Del: non-english -- https://master.php.net/note/delete/113380/non-english
Del: in docs -- https://master.php.net/note/delete/113380/in+docs
Del: other reasons-- https://master.php.net/note/delete/113380
Reject -- https://master.php.net/note/reject/113380
Search -- https://master.php.net/manage/user-notes.php