[PHP-DEV] Re: new construct
__construct is the new method of defining a constructor, but the 'bug' you suspect is not a bug. The parser will search for a function of the same name in the class as the constructor for backwards compatibility with Older scripts, etc... This is done by design, not by 'bugginess'. ~ Andrew Heebner -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: new construct
Andrew Heebner wrote: This is done by design, not by 'bugginess'. For backwards compatibility, if the Zend Engine 2.0 cannot find a __construct() function for a given class, it will search for the old-style constructor function, by the name of the class. in the exmaple it uses the 'old style' constructor *although* __construct() could have been found ...? -- Six Offene Systeme GmbH http://www.six.de/ i.A. Hartmut Holzgraefe Email: [EMAIL PROTECTED] Tel.: +49-711-99091-77 Sie finden uns auf der CeBIT in Halle 6/H44 http://www.six.de/cebit2003/ -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] Re: new construct
__construct is the new method of defining a constructor, but the 'bug' you suspect is not a bug. The parser will search for a function of the same name in the class as the constructor for backwards compatibility with Older scripts, etc... But shouldn't __construct() be searched for and used prior to the old-style constructor? Intuitively it seems it should. John -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Re: new construct
Perhaps i may be mistaken, but it seems logical to search for the old-style constructor first in order to be backwards compatible with old-style scripts. Putting __construct in old style classes would yield a classname of '__construct', an ugly and unlikely name for a class. Seeing as A::A() would be much nicer, i can see the logic behind parsing the old-style first, rather than the new-style. That's just my two cents, feel free to correct me otherwise.. ~ Andrew Heebner __construct is the new method of defining a constructor, but the 'bug' you suspect is not a bug. The parser will search for a function of the same name in the class as the constructor for backwards compatibility with Older scripts, etc... But shouldn't __construct() be searched for and used prior to the old-style constructor? Intuitively it seems it should. John -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DEV] Re: new construct
I was asking myself -- I had assumed that __construct() would be searched for first. I was /am under the impression __construct() is a special function that the engine wouldn't allow you to use in PHP5 in any other context than its intended purpose. I don't know what Zeev plans on doing with this, but perhaps an option would be to issue a notice or warning if both A::A() and __construct() exist in a single class A and call __construct() in those cases... Just a thought. John Perhaps i may be mistaken, but it seems logical to search for the old-style constructor first in order to be backwards compatible with old-style scripts. Putting __construct in old style classes would yield a classname of '__construct', an ugly and unlikely name for a class. Seeing as A::A() would be much nicer, i can see the logic behind parsing the old-style first, rather than the new-style. That's just my two cents, feel free to correct me otherwise.. ~ Andrew Heebner __construct is the new method of defining a constructor, but the 'bug' you suspect is not a bug. The parser will search for a function of the same name in the class as the constructor for backwards compatibility with Older scripts, etc... But shouldn't __construct() be searched for and used prior to the old-style constructor? Intuitively it seems it should. John -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php