Skip to content

Stdlib: substr_compare null $case_insensitive Z_PARAM_BOOL (#29756) - #29787

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-29756-substr-compare-null-ci
Aug 10, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/stdlib-29756-substr-compare-null-ci

Conversation

@PurHur

@PurHur PurHur commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix substr_compare(..., null) $case_insensitive to match php-src ext/standard/string.c Z_PARAM_BOOL: TypeError under strict_types, soft-null DEP+coerce otherwise.
  • VM uses VmMath::parseBoolBuiltinArgForFrame; JIT/AOT uses JitBoolArg::lowerCoerceZParamBool with an early return after compile-time null TypeError so try/catch AOT does not emit IR after a terminator.
  • Compliance + AOT fixture guards; removes the LogicException “must be boolean in this compiler build” shortcut.

Closes #29756

php-src reference

  • ext/standard/string.cZ_PARAM_BOOL / php_substr_compare $case_insensitive

Test plan

  • Zend / VM / JIT repro → TypeError: … $case_insensitive must be of type bool, null given
  • AOT bin/compile.php + run of test/repro/issue_substr_compare_null_ci_aot.php
  • vendor/bin/phpunit --filter SubstrCompareNullCi → OK (4)
  • vendor/bin/phpunit --filter substr_compare_null_ci_strict → OK (includes AotTest)

Not covered / pillar note

  • north-star5-verify-fast / release-readiness currently red on master for spine missing lib/JIT/TypedParamCoerce.php (unrelated to this change).

Made with Cursor

Match php-src string.c — TypeError under strict_types; soft-null DEP+coerce otherwise. Early-return after compile-time null TypeError so AOT try/catch does not emit IR after a terminator.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit be4c077 into master Aug 10, 2026
1 check failed
@PurHur
PurHur deleted the agent/stdlib-29756-substr-compare-null-ci branch August 10, 2026 11:12
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: substr_compare(..., null) $case_insensitive coerces — Zend TypeError (ext/standard/string.c)

1 participant