ID: 41428
Comment by: judas dot iscariote at gmail dot com
Reported By: dasher at inspiredthinking dot co dot uk
Status: Open
Bug Type: Class/Object related
Operating System: Windows Vista Ultimate x64
PHP Version: 5.2.2
New Comment:
huh ? it raises the expected error message..
PHP Fatal error: Call to undefined method parentClass::parentclass()
this is the expected behaviuor as parent::parentClass(); does not
exists at all.
Previous Comments:
------------------------------------------------------------------------
[2007-05-18 09:14:31] dasher at inspiredthinking dot co dot uk
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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41428&edit=1