Re: Status of PEAR_ErrorStack5.php

From: Date: Wed, 20 Sep 2006 16:56:23 +0000
Subject: Re: Status of PEAR_ErrorStack5.php
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-43988@lists.php.net to get a copy of this message
On 2006 09 20 10:43, Greg Beaver wrote:
Alan Langford wrote:
I have found PEAR_ErrorStack5.php in CVS (pear-core). It is a more "PHP5 native" version of PEAR_ErrorStack.php, but it still uses many pre-version 5 constructs (for example, global constants). It's also somewhat out of date -- with a CVS Id in 2004 -- and lacking some features in the distributed version (oddly, I see it as passing all the QA tests, but there are some cases where I expected failure... I'm working on determining why). This file is not present in the distributed version (a good thing IMO). Is this file being maintained? I have been working on adapting it to use everything PHP5 has to offer, but as soon as I start rolling constants into the class, there is no hope of maintaining BC. This message is really just a request for confirmation that I understand the relevant policies and naming conventions. Given that I'm really insane enough to continue this process, it seems to me that the correct name for a replacement file would be PEAR_ErrorStack2.php, the updated QA suite would live in the tests/PEAR_ErrorStack2 directory and the package would be PEAR_ErrorStack2-0.1.0. Am I correct?
PEAR_ErrorStack5.php was a proof-of-concept to show that by changing about 20 characters, PEAR_ErrorStack would become PHP5 E_STRICT compatible. Of course, now that var is allowed again, the number of characters has changed to even fewer (just defining static methods as static, and removing assign by ref for new). This was back when the ideologues were saying all kinds of BS FUD about PEAR_ErrorStack. The file has not been touched since then, but I wanted to keep it around. A more interesting alternative imo is in PEAR/Warning.php, a PHP5-based implementation of non-exceptional errors that allows easy promotion to exceptions and demotion of exceptions. It also has the advantage of not needing to be loaded prior to use (encasing calls in if class_exists() is enough) Greg
I like that approach. I could use this in a variety of XML parsing applications, where I have similar mechanisms embedded in the class. PEAR/Warning.php also seems to be a little out of date, referencing global constants that are now embedded in the PEAR_Exception class. Also, the first parameter to function localAdd should be $codeOrException rather than just $code. I'm also wrestling with method names. I am not fond of prepending "static" to a method name that mirrors an instantiated counterpart, but at the same time, all of the alternatives I have come up with range from "inadequate" to "sucks" (eg. setGlobalCallback). English needs a short word that means "class global", but until then if anyone wants to make suggestions, I'm desperate\\\\\\\\\ open for ideas.

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