if __construct() and old-style constructor are present, PHP chooses whichever

comes first (fixes #66926)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337534 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Christoph Michael Becker 2015-08-18 13:41:19 +00:00
parent 484885f2db
commit 5098c06cdd

View file

@ -62,13 +62,15 @@ $obj = new OtherSubClass();
</programlisting>
</example>
<para>
For backwards compatibility, if PHP 5 cannot find a
<link linkend="object.construct">__construct()</link> 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.
For backwards compatibility, if a
class did not inherit a <link linkend="object.construct">__construct()</link> from a parent class,
either __construct() or the
old-style constructor function with the name of the class will be used as constructor function,
whichever comes first.
Effectively, it means that the only case that would have compatibility
issues is if the class had a method named
<link linkend="object.construct">__construct()</link> which was used for different semantics.
<link linkend="object.construct">__construct()</link> which was used for different semantics,
and which came lexically before the old-style constructor.
</para>
<para>
Unlike with other methods, PHP will not generate an