Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.0

Bug #9252 No error when required arguments are missing
Submitted: 2006-11-07 10:26 UTC
From: cweiske Assigned: scottmattocks
Status: Closed Package: Console_Getargs (version 1.3.2)
PHP Version: Irrelevant OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-11-07 10:26 UTC] cweiske (Christian Weiske)
Description: ------------ factory() should return a USER_ERROR if required arguments are omitted. It doesn't. Call the test script without any paramters, and it will run until end. Test script: --------------- <?php require_once 'Console/Getargs.php'; $config = array( 'server' => array( 'min' => 1, 'max' => 1, 'desc' => 'SMTP server'), 'port' => array( 'min' => 1, 'max' => 1, 'desc' => 'SMTP server port', 'default' => 25), ); $args = Console_Getargs::factory($config); if (PEAR::isError($args)) { if ($args->getCode() === CONSOLE_GETARGS_ERROR_USER) { echo Console_Getargs::getHelp($config, null, $args->getMessage())."\n"; } else if ($args->getCode() === CONSOLE_GETARGS_HELP) { echo Console_Getargs::getHelp($config)."\n"; } exit; } echo "ba\n"; ?> Expected result: ---------------- Help message telling that required paramters are missing. Actual result: -------------- ba

Comments

 [2006-11-07 13:54 UTC] scottmattocks (Scott Mattocks)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Console_Getargs