Skip to content

Single hyphen fixes; "-" value/operand for stdin/stdout

Thomas Flori requested to merge github/fork/tistre/Single-dash-fixes into master

Created by: tistre

In many Unix tools, the single hyphen “-” stands for stdin or stdout. I want to follow this convention in my PHP CLI scripts. But Getopt.php failed with one of these errors when I used “-” as option value or operand:

UnexpectedValueException: Option '' is unknown UnexpectedValueException: Option 'a' must have a value

My commit seems to fix these problems. If it looks fine to you, it would be great to have it included in the next release of Getopt.php. Thanks for creating Getopt.php, and for making it open source!

P.S.: Sorry that this pull request includes the GetoptTest.php changes from my previous request. I’m a Git newbie and haven’t learned how to do proper branches yet.

Merge request reports