Re: PEAR CVS version

From: Date: Tue, 09 Dec 2003 13:46:46 +0000
Subject: Re: PEAR CVS version
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-24310@lists.php.net to get a copy of this message
Pierre/Andrei: Console_Getopt:::getopt() is a static method, so there is no way to set a class option, the only choice is a global variable. $GLOBALS['_CONSOLE_GETOPT_BC'] = true; class Console_Getopt { function use1_0API() {
      $GLOBALS['_CONSOLE_GETOPT_BC' ] = true;
} function use2_0API() {
      $GLOBALS['_CONSOLE_GETOPT_BC'] = false;
} function getopt($params_that_i_forget) {
      if ($GLOBALS['_CONSOLE_GETOPT_BC']) {
         if (isset($params[0]{0}) && $params[0]{0} != '-') {
            array_shift($params[0]{0});
         }
etc. As for merging Console_Getopt into the PEAR core, this makes sense - if I find myself wanting to do a circular dependency (PEAR depends on Console_Getopt depends on PEAR), that means it really isn't a separate package. Another option for preserving BC would be to add a new method class Console_Getopt { function getopt2($params) {
      // same as getopt but doesn't do array_shift()
In the release notes, you could explain that getopt2 fixes the bug in getopt, but breaks BC, so should be switched to by all future projects that desire 100% compatibility with the getopt command. Regards, Greg Pierre-Alain Joye wrote:
On Sat, 6 Dec 2003 20:25:01 -0800 Andrei Zmievski <andrei@gravitonic.com> wrote:
Greg, Was it you who suggested a global var that packages can set to keep BC? Something like $_GLOBALS['CONSOLE_GETOPT_BC']? I lost your message so just wanted to make sure that it would okay with everyone.
It's ok here (a very small ok, as it's an ugly hack). That will save us to add possible console bugs in the current PEAR head. And we can fire a last RC before the stable release. I would really like to find a solution to merge Console_GetOpt to PEAR core, what do you think Andrei? pierre


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