|
Posted by Henk verhoeven on 07/10/07 19:40
lawrence k wrote:
> How do others handle default parameter values?
I guess you mean "how do others handle missing parameters?"
Well, on the development server my error handler will produce a walkback
so that i can see where the call was coming from.
Example:
/** class of the user interface component being called upon
class PntFilterFormPart extends PntPagePart {
*// function that will be called */
function setImplicitCombiFilter(&$combiFilter) {
(....)
/** Front controller class /*
class Site extends PntSite {
function setErrorHandler() {
includeClass('ErrorHandler');
$this->errorHandler =& new ErrorHandler();
$this->errorHandler->startHandling();
}
(....)
/* class of the actual controller producing the requested page, contais
the errorneous call */
class MclUrenSearchPage extends ObjectSearchPage {
function &getFilterFormPart() {
$part =& parent::getFilterFormPart();
$part->setImplicitCombiFilter(); //parameter missing
//should have passed an instance of PntSqlCombiFilter
return $part;
}
Output from development server:
E_WARNING: 'Missing argument 1 for
PntFilterFormPart::setImplicitCombiFilter(), called in
C:\metaclass\websites\@ndere\webtoko\classes\mcl\project\classMclUrenSearchPage.php
on line 9 and defined' in
C:\metaclass\websites\@ndere\webtoko\classes\pnt\web\parts\classPntFilterFormPart.php
at line 585
Request params:
'pntType'=>'Uren',
'pntHandler'=>'SearchPage',
'pntScd'=>'d',
'PHPSESSID'=>'66381c07e127a5ab7e3309dc27598741'
class function line
-----------------------------------------------------------
PntFilterFormPart setImplicitCombiFilter
MclUrenSearchPage getFilterFormPart 9
PntObjectSearchPage getRequestedObject 75
PntObjectIndexPage initForHandleRequest 41
PntPage handleRequest 122
PntSite forwardRequest 203
array('pntType'=>'Uren', 'pntHandler'=>'SearchPage', 'pntScd'=>'d',
'PHPSESSID'=>'66381c07e127a5ab7e3309dc27598741')
PntSite handleRequest 194
- - 5 project\index.php
BTW, passing objects by reference is standard procedure in php4. It
excludes the use of defaults.
Greetings,
Henk Verhoeven,
www.phpPeanuts.org.
[Back to original message]
|