Re: fix for PEAR bug #964, check before commit
| From: | Greg Beaver | Date: | Fri, 19 Mar 2004 14:50:31 +0000 |
| Subject: | Re: fix for PEAR bug #964, check before commit | ||
| References: | 1 2 | Groups: | php.pear.core |
| Request: | Send a blank email to pear-core+get-197@lists.php.net to get a copy of this message | ||
Hi Martin,
I'm pretty sure this idea is impossible.
PEAR_Error was never designed to be an exception class. Also, getMessage() is a final method, and so cannot be overridden with PEAR_Error's getMessage() or any subclass. There is no way to preserve both backwards compatibility and forwards compatibility.
If it was at all a possibility, I would instead define a superclass to PEAR
if (class_exists('Exception')) {
class __PEARparent extends Exception {}
} else {
class __PEARparent {}
}
class PEAR extends __PEARparent {....
But, the finalness of all Exception methods except __toString() negates this possibility.
Greg
Martin Jansen wrote:
Unrelated to my previous mail, here is an attempt to fix the problem in another way. It is written pretty much from the top of my head, so I'm not sure, if it works out at all. Instead of dropping PEAR_ERROR_EXCEPTION, a new (empty) class Exception is introduced, from which PEAR_Error is a subclass.