Doc #66926 [Com]: old-style constructor and __construct()

From: Date: Thu, 03 Sep 2015 21:21:13 +0000
Subject: Doc #66926 [Com]: old-style constructor and __construct()
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12715@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66926&edit=1 ID: 66926 Comment by: miksir at maker dot ru Reported by: wako057 at gmail dot com Summary: old-style constructor and __construct() Status: Closed Type: Documentation Problem Package: Scripting Engine problem Operating System: Debian PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: PHP5 always use __construct, not whichever comes first https://3v4l.org/7eg0E https://3v4l.org/K0FqA Previous Comments: ------------------------------------------------------------------------ [2015-08-18 13:41:56] cmb@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. ------------------------------------------------------------------------ [2015-08-18 13:41:21] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=337534 Log: if __construct() and old-style constructor are present, PHP chooses whichever comes first (fixes #66926) ------------------------------------------------------------------------ [2015-04-17 11:21:56] cmb@php.net > The problem describe here is php raised an error depending on > which method the parser find first, not if it is present or not. Thanks, now its clear to me what you are referring to. And indeed, the documentation should be improved. ------------------------------------------------------------------------ [2015-04-17 08:41:35] wako057 at gmail dot com Hello, The qualification is maybe not the correct one, it can be a parser probleme. My native language is French. Assuming english is not my native one maybe im wrong, but I think both doc are inexact: Doc: For backwards compatibility, if PHP 5 cannot find a __construct() function for a given class, and the class did not inherit one from a parent class, it will search for the old-style constructor function, by the name of the class. Effectively, it means that the only case that would have compatibility issues is if the class had a method named __construct() which was used for different semantics. So <<if PHP 5 cannot find>> The problem describe here is php raised an error depending on which method the parser find first, not if it is present or not. Regards. ------------------------------------------------------------------------ [2015-04-17 00:35:43] cmb@php.net The reported behavior is to be expected, see the man page on "Constructors and Destructors"[1]. You have filed this as "Missing Information in translation", so we have to assume that there is a documentation translation problem. It is not clear, however, which translation (i.e. language) is affected. Can you please clarify? [1] <http://php.net/manual/en/language.oop5.decon.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 https://bugs.php.net/bug.php?id=66926 -- Edit this bug report at https://bugs.php.net/bug.php?id=66926&edit=1

« previous php.doc.bugs (#12715) next »