Re: PEAR2 standards: anything good at all?
| From: | Alexey Borzov | Date: | Mon, 16 Jul 2007 15:35:41 +0000 |
| Subject: | Re: PEAR2 standards: anything good at all? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-47527@lists.php.net to get a copy of this message | ||
Hi,
Philippe Jausions wrote:
Ok, let's assume, we get rid of all *_once calls in all PEAR2 packages, and force a user to go with either allfiles.php (for opcode cache environment only IMO) or an implementation (user-provided or PEAR-provided) of an autoload function. Given the above, how do we implement factory() methods in PEAR2 packages, especially in the cases of fallback drivers and/or optional dependencies? A lot of factory() methods currently test existence of classes in some way or another, and return PEAR_Error instances in case of failure. In other terms, would we forbid to pass FALSE to class_exists() in such factory() methods? Obviously, if we try to load a class that doesn't exists a fatal error will occur, which may not be a desirable behavior, specially for a factory() method. Submit sample code please :-)Yeah, and while we are at it, there is that nice note in PHP manual: Note: Exceptions thrown in __autoload function cannot be caught in the catch block and results in a fatal error. http://ru2.php.net/manual/en/language.oop5.autoload.php