My apologies. I've not seen something I should have earlier. Also the instance that is behind all of this is and instance of ActiveRecordFormClass.
So, in PHP4, the correct overridden method is called: ActiveRecordFormClass::_dispatchSave(). In PHP5, the FormClass::_dispatchSave() is called...??? BTW I'm tracing this though with xdebug. Regards, Tom Tom Robinson System Administrator On 17/03/11 13:06, Tom Robinson wrote: > Hi, > > I'm trying to decipher inherited code (I did not write this) and I'm > having great difficulty understanding the override of a method in PHP4 > vs PHP5 > > Here's the code: > > form.php > 22 class FormClass > 23 { > ... > /* some method calls to _dispatchSave() */ > 572 if($this->_dispatchSave($key) === FALSE) > 573 { > 574 return FALSE; > 575 } > ... > /* _dispatchSave is defined */ > 692 function _dispatchSave($key) > 693 { > > arform.php > 17 class ActiveRecordFormClass extends FormClass > 18 { > ... > /* _dispatchSave is defined */ > 84 function _dispatchSave(&$key) > 85 { > > In PHP 4.3.9: > > The arform.php implementation of _dispatchSave is called > (i.e.ActiveRecordFormClass::_dispatchSave())in preference to the one > defined in it's own class. This is the desired call BTW but why does > this happening? I would expect the parent implementation to be called, > not a child implementation??? > > In PHP 5.1.6: > > I get the warning: > > "PHP Strict Standards: Declaration of > ActiveRecordFormClass::_dispatchSave() should be compatible with that of > FormClass::_dispatchSave() in ..." > > which is expected since the parameters are defined differently. As I > expected, the FormClass::_dispatchSave() implementation is called in > PHP5. This implementation does not have the desired effect (the > application crashes). > > What is happening? Maybe I'm not seeing something simple. I look forward > to any responses. > > Regards, > > Tom > > > >
signature.asc
Description: OpenPGP digital signature