#41819 [Opn->Bgs]: Old style Constructor inconsistencies
| From: | vrana@php.net | Date: | Thu, 16 Aug 2007 13:22:19 +0000 |
| Subject: | #41819 [Opn->Bgs]: Old style Constructor inconsistencies | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969377421@lists.php.net to get a copy of this message | ||
ID: 41819
Updated by: vrana@php.net
Reported By: oancea at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: *
PHP Version: 5.2.3
New Comment:
Documentation is not saying that classname() is an alias of
__construct(). It says that it is fallback if __construct() is not
defined.
Your interface declares method which is not defined in the class.
Previous Comments:
------------------------------------------------------------------------
[2007-06-27 10:11:45] oancea at gmail dot com
Re-open to mark as a documentation problem.
------------------------------------------------------------------------
[2007-06-27 08:59:14] oancea at gmail dot com
Well, as far as I can see, both of those functions are constructors,
one (__constructor) specifies the signature of an object, and the other
one implements it.
According to this bug (fixed in 5.1):
http://bugs.php.net/bug.php?id=35720 in the end
is the same method.
Anyway, thank you for your time, and I hope that at least the
documentation will add my example as "don't do this because __construct
and old style constructor are two different functions for interfaces or
abstract classes"!
------------------------------------------------------------------------
[2007-06-27 08:50:16] tony2001@php.net
Nobody said it cannot be used, but __construct() and XMLConfigurator()
are two different functions, so the result you get is pretty much
expected.
------------------------------------------------------------------------
[2007-06-27 08:48:25] oancea at gmail dot com
How about this one:
abstract class IConfigurator {
public abstract function __construct();
}
class XmlConfigurator extends IConfigurator {
public function XmlConfigurator() {
printf("%s\n", __METHOD__);
}
}
$config = new XmlConfigurator();
Can you point me to the exact documentation where it states that the
old style constructor should not be used, at least not in interfaces or
in abstract classes?
Thank-you.
------------------------------------------------------------------------
[2007-06-27 08:28:54] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/41819
--
Edit this bug report at http://bugs.php.net/?id=41819&edit=1