note 25748 added to keyword.parent
| From: | sal at stodge dot org | Date: | Fri, 04 Oct 2002 02:57:35 +0000 |
| Subject: | note 25748 added to keyword.parent | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-37653@lists.php.net to get a copy of this message | ||
<p>When using the technique suggested by "<b>minoc at mindspring dot
com</b>" on this page - USE EXTREME CAUTION.</p>
The problem is that if you inherit of a class that uses this kludge in the constructor you will end
up with a recursive constructor - unless that new class has a constructor of it's own that
by-passes the kludged constructor.
What I am saying, is you can use this technique as long as you can ensure that each class you
inherit from a class containing this technique in the constructor has a constructor class of
it's own that does not call the parent constructor...
On balance it is probably easier to specify the name of the constructor class explicitly!
If you make this mistake the symptoms are pretty easy to spot - PHP spirals into an infinitely
recursive loop as soon as you attempt to construct a new class. Your web-server will returns an
empty document.
--
http://www.php.net/manual/en/keyword.parent.php
http://master.php.net/manage/user-notes.php?action=edit+25748
http://master.php.net/manage/user-notes.php?action=delete+25748
http://master.php.net/manage/user-notes.php?action=reject+25748