Re: PEAR.php -> PEAR_Error - is it a "bug/misspelling" ?

From: Date: Sat, 06 Mar 2004 12:13:42 +0000
Subject: Re: PEAR.php -> PEAR_Error - is it a "bug/misspelling" ?
References: 1 2  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-11131@lists.php.net to get a copy of this message
Hi Jesus I understand what you write, but I can't see how it relates to the question... - maybe I don't understand at all!? Cheers, Tommy. Jesus M. Castagnetto wrote:
That is to make the methods work when called from an instance or statically (PHP 4 does not have an enforced static concept, PHP 5 does), e.g. $obj=new Bar(); $obj->foo(); vs Bar::foo(); Cheers. --- Tommy Ipsen <tipsen@imada.sdu.dk> wrote:
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 -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
===== -- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ PEAR stuff: http://pear.php.net/user/jmcastagnetto __________________________________ Do you Yahoo!? Yahoo! Search - Find what you’re looking for faster http://search.yahoo.com


« previous php.pear.general (#11131) next »