Skip to content

fix(cli): clear getopt optarg for optional long options#21902

Open
onthebed wants to merge 1 commit intophp:masterfrom
onthebed:clawoss/fix/getopt-clear-optional-optarg
Open

fix(cli): clear getopt optarg for optional long options#21902
onthebed wants to merge 1 commit intophp:masterfrom
onthebed:clawoss/fix/getopt-clear-optional-optarg

Conversation

@onthebed
Copy link
Copy Markdown

php_getopt() left *optarg unchanged when a long option with an optional argument was passed without a value, so the CLI parser could reuse the previous option's argument for --ini.

Clear optarg at the start of php_getopt() and add a regression test that exercises -d foo=bar --ini.

Fixes #21901

@onthebed onthebed requested a review from bukka as a code owner April 28, 2026 19:26
@Girgias
Copy link
Copy Markdown
Member

Girgias commented Apr 29, 2026

CI failures are related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php_getopt() does not clear *optarg for long options with optional argument when value is absent — --ini regression in 8.5

2 participants