Forums before death by AOL, social media and spammers... "We can't have nice things"
|    linux.debian.bugs.dist    |    Ohh some weird Debian bug report thing    |    28,835 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 28,037 of 28,835    |
|    Renan Rodrigo to All    |
|    Bug#1128313: php-console-commandline: Fa    |
|    18 Feb 26 03:20:01    |
   
   From: rr@ubuntu.com   
      
   Package: php-console-commandline   
   Version: 1.2.6-1   
   Severity: normal   
   X-Debbugs-Cc: rr@ubuntu.com   
      
   Dear Maintainer,   
      
   php-console-commandline v1.2.6-1 autopkgtests fail when running with PHP   
   8.5. The diff for the failing tests don't say much:   
      
   FAIL [12/53] Test for Console_CommandLine::addOption() method (errors   
   5).[/tmp/autopkgtest.bpChUz/build.19f/real-tree/tests/console_co   
   mandline_addoption_errors_5.phpt]   
   ========DIFF========   
   002+ Stack trace:   
   003+ #0 /usr/share/php/Console/CommandLine.php(855): trigger_error()   
   004+ #1 /usr/share/php/Console/CommandLine/Option.php(308): Cons   
   le_CommandLine::triggerError()   
   005+ #2 /usr/share/php/Console/CommandLine.php(646): Console_Com   
   andLine_Option->validate()   
   006+ #3 /tmp/autopkgtest.bpChUz/build.19f/real-tree/tests/consol   
   _commandline_addoption_errors_5.php(6): Console_CommandLine->addOption()   
   007+ #4 {main}   
   ========DONE========   
      
   trigger_error is using E_USER_ERROR, which is deprecated, and that seems   
   to be the cause of the failures.   
      
   I have applied the following patch in Ubuntu, which resolves the   
   situation by throwing actual exceptions:   
      
   --- a/Console/CommandLine.php   
   +++ b/Console/CommandLine.php   
   @@ -826,8 +826,7 @@   
    {   
    if (!isset(self::$actions[$name])) {   
    if (!class_exists($class)) {   
   - self::triggerError('action_class_does_not_exists',   
   - E_USER_ERROR,   
   + self::throwException('action_class_does_not_exists',   
    array('{$name}' => $name, '{$class}' => $class));   
    }   
    self::$actions[$name] = array($class, false);   
   @@ -835,27 +834,24 @@   
    }   
      
    // }}}   
   - // triggerError() {{{   
   + // throwException() {{{   
      
    /**   
   - * A wrapper for programming errors triggering.   
   + * A wrapper for programming Exception throwing.   
    *   
    * @param string $msgId Identifier of the message   
   - * @param int $level The php error level   
    * @param array $params An array of search=>replaces entries   
    *   
    * @return void   
   - * @todo remove Console::triggerError() and use exceptions only   
    */   
   - public static function triggerError($msgId, $level, $params=array())   
   + public static function throwException($msgId, $params=array())   
    {   
   + $msg = 'unknown error';   
    if (isset(self::$errors[$msgId])) {   
    $msg = str_replace(array_keys($params),   
    array_values($params), self::$errors[$msgId]);   
   - trigger_error($msg, $level);   
   - } else {   
   - trigger_error('unknown error', $level);   
    }   
   + throw new \Exception($msg);   
    }   
      
    // }}}   
   --- a/tests/console_commandline_addargument.phpt   
   +++ b/tests/console_commandline_addargument.phpt   
   @@ -112,4 +112,4 @@   
    }   
    }   
      
   -Fatal error: argument name must be a valid php variable name (got: Some   
   invalid name) in %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: argument name must be a valid php variable   
   name (got: Some invalid name) in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addargument_2.phpt   
   +++ b/tests/console_commandline_addargument_2.phpt   
   @@ -25,4 +25,4 @@   
    ?>   
    --EXPECTF--   
    foo bar   
   -Fatal error: only optional arguments can have a default value in   
   %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: only optional arguments can have a default   
   value in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_1.phpt   
   +++ b/tests/console_commandline_addoption_errors_1.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: option name must be a valid php variable name (got: Some invalid   
   name) in %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: option name must be a valid php variable   
   name (got: Some invalid name) in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_2.phpt   
   +++ b/tests/console_commandline_addoption_errors_2.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: you must provide at least an option short name or long name for   
   option "name" in %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: you must provide at least an option short   
   name or long name for option "name" in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_3.phpt   
   +++ b/tests/console_commandline_addoption_errors_3.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: option "name" short name must be a dash followed by a letter   
   (got: "d") in %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: option "name" short name must be a dash   
   followed by a letter (got: "d") in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_4.phpt   
   +++ b/tests/console_commandline_addoption_errors_4.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: option "name" long name must be 2 dashes followed by a word   
   (got: "d") in %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: option "name" long name must be 2 dashes   
   followed by a word (got: "d") in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_5.phpt   
   +++ b/tests/console_commandline_addoption_errors_5.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: invalid action for option "name". in %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: invalid action for option "name". in   
   %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_6.phpt   
   +++ b/tests/console_commandline_addoption_errors_6.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: unregistered action "Inexistant" for option "name". in   
   %sCommandLine.php on line %d   
   +Fatal error: Uncaught Exception: unregistered action "Inexistant" for option   
   "name". in %sCommandLine.php on line %d   
   --- a/tests/console_commandline_addoption_errors_7.phpt   
   +++ b/tests/console_commandline_addoption_errors_7.phpt   
   @@ -11,4 +11,4 @@   
    ?>   
    --EXPECTF--   
      
   -Fatal error: you must provide a valid callback for option "name" in   
   %sCommandLine.php on line %d   
      
   [continued in next message]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca