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
Attachment:
signature.asc
Description: OpenPGP digital signature