Skip to content

Add mb_str_split() UTF-8/ASCII chunking (#3299) - #15473

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-3299-mb-str-split
Jul 3, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-3299-mb-str-split

Conversation

@PurHur

@PurHur PurHur commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement mb_str_split() in ext/mbstring/ via VmMbstring::strSplit() — UTF-8 character chunks and ASCII/8BIT byte chunks per php-src ext/mbstring/mbstring.c
  • Register builtin in mbstring module; ValueError when $length <= 0
  • Add repro + compliance guard; refresh capability matrix

Closes #3299

php-src reference

  • ext/mbstring/mbstring.c — PHP_FUNCTION(mb_str_split)

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/maintainer_gap_mb_str_split.php
php bin/vm.php test/repro/maintainer_gap_mb_str_split.php
'

Output (Zend and VM identical):

array ( 0 => 'α', 1 => 'β', 2 => 'γ', )
array ( 0 => 'ab', )
array ( 0 => 'he', 1 => 'll', 2 => 'o', )
array ( )
length_zero=ValueError
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter mb_str_split'
# OK (2 tests, 2 assertions)

./script/ci-fast.sh --filter mb_str_split
# green (capability matrix regenerated)

Made with Cursor

Implements php-src mb_str_split semantics in ext/mbstring with VM builtin,
ValueError on non-positive length, repro, and compliance guard.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 00d2e71 into master Jul 3, 2026
@PurHur
PurHur deleted the agent/issue-3299-mb-str-split branch July 3, 2026 12:10
PurHur added a commit that referenced this pull request Jul 3, 2026
)

Regenerate bootstrap-inventory.md (3843→3846) after mb_str_split and
unlink JIT helpers landed; add ext/mbstring/mb_str_split.php to the
self-host spine require list.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Stdlib: mb_str_split() — multibyte string to array (ext/mbstring parity)

1 participant