You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can open a PR to fix this if it suits @cheprasov
robincafolla
changed the title
array_shift causes arguments following as zero argument to be omitted
array_shift causes arguments following a zero argument to be omitted
Feb 9, 2021
Problem
Use of the return result from
array_shift
as the condition of the loop here:php-cli-args/src/CliArgs/CliArgs.php
Line 293 in fddcd44
Causes any arguments after a zero argument to be omitted. This is because the zero value is evaluated as false.
Test case
Running the above script with
php test.php --a 1 --b 0 --c 1
will result in the following output:The value for
b
is incorrect, andc
is missing entirely.Recommendation
Replace
with
The text was updated successfully, but these errors were encountered: