note 83252 added to language.oop5.decon
| From: | KK at osu1 dot php dot net | Date: | Fri, 16 May 2008 20:57:53 +0000 |
| Subject: | note 83252 added to language.oop5.decon | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139456@lists.php.net to get a copy of this message | ||
I ran into an interesting (and subtle) code error while porting some code to PHP 5.2.5 from PHP
4.4.8 that I think illustrates a noteworthy semantic.
I have a hierarchy of classes with both styles of constructors but where one in the middle was
missing the __construct() function (it just had the old-style one that called the (nonexistent)
__construct()). It worked fine in PHP4 but caused an endless loop (and stack overflow) in PHP5. I
believe what happened is that in PHP4 the old-style constructor was not called, but in PHP5 it was
(due to the "emulation" of PHP4), and since _construct() wasn't defined for that
class, the call to $this->__construct() caused a looping call to the original (lowest child)
constructor.
----
Server IP: 208.69.120.35
Probable Submitter: 208.178.64.62
----
Manual Page -- http://www.php.net/manual/en/language.oop5.decon.php
Edit -- https://master.php.net/note/edit/83252
Del: integrated -- https://master.php.net/note/delete/83252/integrated
Del: useless -- https://master.php.net/note/delete/83252/useless
Del: bad code -- https://master.php.net/note/delete/83252/bad+code
Del: spam -- https://master.php.net/note/delete/83252/spam
Del: non-english -- https://master.php.net/note/delete/83252/non-english
Del: in docs -- https://master.php.net/note/delete/83252/in+docs
Del: other reasons-- https://master.php.net/note/delete/83252
Reject -- https://master.php.net/note/reject/83252
Search -- https://master.php.net/manage/user-notes.php