#011435: ConsoleInput does not reset $option->value;

Description:

$input = new ezcConsoleInput();
$input->registerOption( new ezcConsoleOption( 'i', 'input', ezcConsoleInput::TYPE_STRING));
$input->process(array("myProg", "-i", "bla"));

$input->process(array("myProg", "-i", "bla"));

Terminates with:


ezcConsoleOptionTooManyValuesException: The option 'input' expects a single value, but multiple were submitted.

Adding: $option->value = false; helps in input.php:

 
    private function processOptions( array $args, &$i )
    {
        $option = $this->getOption( preg_replace( '/^-+/', '', $args[$i++] ) );
// !!!!
        $option->value = false;
// !!!!
        // Is the actual option a help option?
        if ( $option->isHelpOption === true )
        {
            $this->helpOptionSet = true;
        }


Environment:

Operating System:
PHP Version: (please be specific, like '4.4.3' or '5.1.5')
Database and version:
Browser (and version):


- Attachments

No attachments for this issue.


- Comments

The suggested fix is not suitable, since this would also allow a single value option to occur multiple times and would take the last submitted value. It is also not intended to call $input->process() multiple times. However, we could add a reset() method to ezcConsoleInput, which resets all option and argument values. Would this suffice your needs?

#255319 by Tobias Schlitt on January 4th, 2008 [Permanent Link]

Why don't you do that when process() is called?

#255320 by Derick Rethans on January 4th, 2008 [Permanent Link]

Fixed in rev. #7091.

#255340 by Tobias Schlitt on January 7th, 2008 [Permanent Link]

- History
Properties
Type Bug
Priority Medium
Component Components » ConsoleTools
Affects Unknown
Fix Version 2007.2.1 - eZ components 2007.2.1
Reporter Raymond Bosman
Responsible Tobias Schlitt
Status 0 Closed
Resolution Fixed
Created September 12th, 2007
Updated January 7th, 2008
Resolved January 7th, 2008
 
Navigation [Permanent Link]
Previous Issue
Back to Issues List
Next Issue: #015537
  Graph shows to small and truncated rotated axis labels