Re: PEAR::isError()

From: Date: Mon, 04 Dec 2000 19:38:17 +0000
Subject: Re: PEAR::isError()
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-510@lists.php.net to get a copy of this message
Chuck Hagenbuch wrote: > > I'd like to modify PEAR::isError() to NOT take its argument by reference. I > understand that this may incur a performance penalty. However, I think that the > readability/useability increase of being able to do: > > if (PEAR::isError(function($vars ...))) { > // do error stuff > } > > ... is worth it. Right now we can't do the above unless function() is defined > to return a reference, and you're going to want to check sucess or failure of > non-reference methods sometimes. > > The current situation I have in mind that exemplifies this is Net/SMTP.php; it > has a lot of lines such as: > if (PEAR::isError($this->socket->connect($this->host, $this->port))) > ... this doesn't work, and even with Andi's fix won't work, because > $socket->connect() returns TRUE on success, which is not a variable, and so > can't be passed by reference. > > Any objections? None here. But it kinda sucks that call-time references are obsoleted and at the same time you can't pass non-variables. Andi? - Stig

« previous php.pear (#510) next »