Re: question about Warnings RFC

From: Date: Tue, 24 Aug 2004 17:45:40 +0000
Subject: Re: question about Warnings RFC
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-32908@lists.php.net to get a copy of this message
Sergio Carvalho wrote:
+0 from me: PEAR_ErrorStack does fill the shoes quite well. I just have to con points: 1) The naming makes people confuse error and warning treatment. Even moreso in mixed PHP4/5 environments, where PEAR_ErrorStack will get used for real error handling.
Yep.
2) PEAR_ErrorStack is geared towards errors, and could be slimmed down to something more oriented towards warnings.
It may be necessary to take two steps: 1) split PEAR_ErrorStack out into its own separate package 2) create a new PEAR_Warning that is a slimmed down PEAR_ErrorStack. Features that I think will be necessary in PEAR_Warning that don't exist in PEAR_ErrorStack 1) allow and encourage the use of exception objects to contain the warning info, as in <?php PEAR_Warning::staticAdd(new MyPackage_ExceptionSomethingWrong(...)); ?> This will allow easy cascading of promoted warnings with existing exceptions, and REALLY easy warning promotion in a callback, although I wouldn't recommend doing this: if (blah) {
    throw $err;
} 2) cascading of exceptions into warnings for demoted exceptions. I also feel that it might even be worth it to drop the requirement of error codes altogether and instead use only exception objects to contain the warning package differentiation information, as using the classname of an exception obsoletes the need for both a package identifier and an error code, simplifying things immensely. Both of these solutions are potentially php4-compatible, incidentally, although neither is PEAR_ErrorStack-compatible. Greg

« previous php.pear.dev (#32908) next »