Commit d6f20c2
Michael Vasseur
Remove FIXME as PHP implemented the return type
The documentation on this is not very clear. You can encounter the `False` by using unset($argv) which would be a misconfiguration so the error message is now also improved.
A better explanation can be found here: https://bugs.php.net/bug.php?id=81352
Which has those comments;
```
[2021-08-12 15:19 UTC] [email protected]
Prior to PHP 8.0.0, FALSE was returned if the function was called
with unexpected parameters or parameter types. Most other
functions returned NULL in that case. Anyhow, there is no need to
document that, since this is actually undefined behavior[1].
For all relevant PHP versions, FALSE will also be returned, if
neither $_SERVER nor $argv exists or are not arrays.
[1] <https://www.php.net/manual/en/functions.internal.php>
[2022-11-26 06:42 UTC] schamberumarcelo at gmail dot com
getopt() will return an empty array if there is no error in splitting strings to args variable. GetOptions() will return a true value if the command line could be processed successfully. Otherwise, it will write error messages using die() and warn(). (https://www.imyccpay.com)github.com
```
given that we run PHP>8.0 and the explanation that parsing will stop for the first non-option I think we'll never encounter the false in practice. To be save we now check the shortoptions string for the right format.
We should consider if we just want to use another function like: https://www.php.net/manual/en/function.getopt.php#834141 parent 34184cd commit d6f20c2
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
487 | 487 | | |
488 | 488 | | |
489 | 489 | | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
494 | 498 | | |
495 | 499 | | |
496 | 500 | | |
| |||
0 commit comments