c9s / GetOptionKit

An object-oriented option parser library for PHP, which supports type constraints, flag, multiple flag, multiple values, required value checking

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal error: Call to a member function isOption() on null

1franck opened this issue · comments

spec option with multiple values output fatal error when value(s) missing

...
$specs->add('b|bar+', 'option with multiple value.' )->isa('Number');
...

$ php script.php -f foo -b

Fatal error: Call to a member function isOption() on null in ...\vendor\corneltek\getoptionkit\src\GetOptionKit\OptionParser.php on line 187

$ php script.php -f foo -b 1 -b 2
Array
(
[0] => 1
[1] => 2
)

OptionParser.php temp fix

if($next) {
    if($next->isOption())
        $i++;
    $result->set($spec->getId(), $spec);
}

Released in 2.1.1