setDefaultValue with OPTIONAL_ARGUMENT results in weird results
Created by: pc-explore
Hi,
can you shed some light on the following cases please ?
In both cases, the script in attachment should be run as follows in order to reproduce the issue: 'php test.php copy --aaa'
- It seems like an optional argument requires a numeric setDefaultValue. If I set it to a string and run the script, I get a warning PHP Warning: A non-numeric value encountered in ...\getopt\vendor\ulrichsg\getopt-php\src\Option.php on line 298
- Also with an optional argument, when I use a numeric setDefaultValue (ex. 6) then I get the value 7 instead of the expected 6
When the script is run like 'php test.php copy', then the outcome is as expected. Tested with the script in attachment, with PHP v. 7.2.7 and getopt-php v. 3.2 test.txt