Skip to content

AOT: mb_strcut() null length via isNullConstant sentinel (#35711) - #35712

Merged
PurHur merged 1 commit into
masterfrom
fix/mb-strcut-null-length-aot
Aug 29, 2026
Merged

AOT: mb_strcut() null length via isNullConstant sentinel (#35711)#35712
PurHur merged 1 commit into
masterfrom
fix/mb-strcut-null-length-aot

Conversation

@PurHur

@PurHur PurHur commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • JitMbStrcut now treats null literal length like peer JitMbSubstr (isNullConstant-1 omit sentinel) instead of falling through to JitStrictIntArg and throwing TypeError.
  • Adds repro + MbNegativeOffsetNullLengthAotTest for negative offset + null length (strict and non-strict).

php-src: ext/mbstring/mbstring.cPHP_FUNCTION(mb_strcut) soft-null length (#21430).

Test plan

./script/aot-smoke.sh
# aot-smoke: 8 passed, 0 failed

./script/phpunit.sh --filter MbNegativeOffsetNullLengthAotTest
# OK (3 tests, 11 assertions)

./script/differential-sweep.sh --aot --dir test/differential/mb-null-probe
# (2 repro files) 2/2 match Zend (aot backend)

Closes #35711

Made with Cursor

…).

JitMbStrcut missed isNullConstant on argument #3, so mb_strcut($s, -N, null)
hit JitStrictIntArg and threw TypeError while peer JitMbSubstr already mapped
null to the -1 omit-length sentinel. Add repro + MbNegativeOffsetNullLengthAotTest.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 8eef16a into master Aug 29, 2026
1 check failed
@PurHur
PurHur deleted the fix/mb-strcut-null-length-aot branch August 29, 2026 09:13
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.

AOT: mb_strcut() null length throws TypeError — isNullConstant not handled (ext/mbstring/mbstring.c)

1 participant