Skip to content

Fix filter_var() nested inline options call-arg slot wiring (#12007) - #12014

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-12007-filter-var-inline-options
Jun 26, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-12007-filter-var-inline-options

Conversation

@PurHur

@PurHur PurHur commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix compiler matchInlineCallArgProducer when php-cfg hoists ConstFetch + nested Array_ preludes for filter_var() third argument (e.g. ['options' => ['regexp' => '/^a/']]).
  • Previously the inner array slot was sent as the $filter operand; now the leading constant maps to the filter arg and the outer array to options.
  • php-src reference: ext/filter/filter.c — php_filter_var(), php_filter_parse_args().

Verification

./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_filter_validate_regexp_options.php
# ok

./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_filter_var_int_null_on_failure.php
# ok

./script/docker-exec.sh -- php bin/vm.php test/compliance/cases/stdlib/filter_validate_regexp.phpt
# string(6) "abc123" / bool(false) / ValueError message / bool(true)

./script/docker-exec.sh -- bash -lc 'cd /compiler && php vendor/bin/phpunit test/unit/InlineCallArgProducerSlotTest.php --filter FilterVar'
# OK (2 tests, 6 assertions)

Closes #12007

Made with Cursor

When php-cfg hoists ConstFetch plus a nested Array_ chain for the third
argument, matchInlineCallArgProducer mapped the inner array to the filter
slot. Map the leading constant to the filter argument and the outer array
to the options argument instead.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit f1d5677 into master Jun 26, 2026
@PurHur
PurHur deleted the agent/issue-12007-filter-var-inline-options branch June 26, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: filter_var() inline options array — filter operand not int (ext/filter/filter.c)

1 participant