|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-18 09:24 UTC] judas dot iscariote at gmail dot com
[2007-05-18 10:58 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 07:00:01 2025 UTC |
Description: ------------ Calling parent::_construct() from an extended class causes a fatal error when the parent doesn't have a constructor. When you've full control over the code - it's not an issue - but when the parent comes from a code library it's becomes difficult to know if you should call the constructor. With code libraries such as PEAR - the parent class might not have a constructor today but might have one tomorrow. Reproduce code: --------------- class parentClass { function someMethod() { } } class childClass extends parentClass { function childClass() { parent::parentClass(); } } $obj = new childClass(); Expected result: ---------------- The code above should run without generating a Fatal error - at most the error should be an E_NOTICE or E_WARNING. Actual result: -------------- Fatal error: Can not call constructor in filename.php on Line 007