PEAR.php -> PEAR_Error - is it a "bug/misspelling" ?
| From: | Tommy Ipsen | Date: | Fri, 05 Mar 2004 20:43:20 +0000 |
| Subject: | PEAR.php -> PEAR_Error - is it a "bug/misspelling" ? | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-11119@lists.php.net to get a copy of this message | ||
Hi everybody
When trying to understand the concept of error handling I stumbled upon the following inconsistency in PEAR.php in the class PEAR_Error:
if ($mode & PEAR_ERROR_CALLBACK) {
$this->level = E_USER_NOTICE;
$this->callback = $options;
} else {
if ($options === null) {
$options = E_USER_NOTICE;
}
$this->level = $options;
$this->callback = null;
}
if ($this->mode & PEAR_ERROR_PRINT) {
if (is_null($options) || is_int($options)) {
$format = "%s";
} else {
$format = $options;
}
printf($format, $this->getMessage());
}
I'm thinking of these two lines:
if ($mode & PEAR_ERROR_CALLBACK) {
if ($this->mode & PEAR_ERROR_PRINT) {
How come one is "$mode" and the other is "$this->mode" ? It shouldn't make any difference but it just seems strange to me with this inconsistency!
Cheers, Tommy