From: dasher at inspiredthinking dot co dot uk Operating system: Windows Vista Ultimate x64 PHP version: 5.2.2 PHP Bug Type: Class/Object related Bug description: Calling parent::__construct() causes a fatal error
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 bug report at http://bugs.php.net/?id=41428&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41428&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41428&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41428&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41428&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41428&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41428&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41428&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41428&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41428&r=support Expected behavior: http://bugs.php.net/fix.php?id=41428&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41428&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41428&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41428&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41428&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41428&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41428&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41428&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41428&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41428&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41428&r=mysqlcfg