PEAR::isError()
| From: | Chuck Hagenbuch | Date: | Mon, 04 Dec 2000 19:20:33 +0000 |
| Subject: | PEAR::isError() | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-507@lists.php.net to get a copy of this message | ||
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?
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"If you can't stand the heat, get out of the chicken!" - Baby Blues