|
Posted by pangea33 on 07/11/07 01:04
On Jul 10, 3:40 pm, Henk verhoeven <news1@phpPeanuts_RemoveThis.org>
wrote:
> 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.
There was a lot of good feedback in this thread, and I am not the sort
of self-absorbed developer who is closed to the viewpoints of others.
A lot of you have made me rethink portions of my original post. Thanks
for keeping it clean and for giving some alternatives rather than
simply bashing. Hopefully some others will weigh in on the subject too.
Navigation:
[Reply to this message]
|