Skip to content

Implement mb_strstr() — multibyte strstr (ext/mbstring parity) - #19942

Merged
PurHur merged 1 commit into
masterfrom
agent/ext-io-mb-strstr
Jul 17, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/ext-io-mb-strstr

Conversation

@PurHur

@PurHur PurHur commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implements mb_strstr() in ext/mbstring/ via VmMbstring::strstr() using existing utf8Strpos + utf8CharSubstr helpers
  • Registers in ext/mbstring/Module.php alongside mb_strrichr
  • Adds compliance PHPT covering basic usage, $before_needle, multibyte chars, and not-found case

Closes #19941

php-src reference

  • ext/mbstring/mbstring.cPHP_FUNCTION(mb_strstr)

Verification

$ php bin/vm.php repro.php
string(5) "World"
string(6) "Hello "
bool(false)
string(11) "é résumé"
string(3) "caf"

$ phpunit --filter mb_strstr
OK (2 tests, 2 assertions)  # VM + JIT

$ phpunit --filter mb_str
OK (40 tests, no regressions)

Test plan

  • VM output matches Zend PHP 8.2 for all repro cases
  • Compliance PHPT passes on VM and JIT
  • No regressions in broader mbstring test suite

Made with Cursor

Closes #19941

Adds mb_strstr($haystack, $needle, $before_needle, $encoding) to the
VM via VmMbstring::strstr() using the existing utf8Strpos + utf8CharSubstr
helpers. Registered in ext/mbstring/Module.php alongside mb_strrichr.

Verification: php bin/vm.php repro.php — output matches Zend PHP 8.2
  phpunit --filter mb_strstr — OK (2 tests, VM + JIT)
  phpunit --filter mb_str — OK (40 tests, no regressions)
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit e0b922b into master Jul 17, 2026
@PurHur
PurHur deleted the agent/ext-io-mb-strstr branch July 17, 2026 07:46
PurHur added a commit that referenced this pull request Jul 17, 2026
…+ FileGetContentsJitHelper PHP (#19339) (#19956)

Remove the ~185 LOC libc open/read LLVM kernel from ext/standard/JitFileGetContentsKernel.php.
StringFileGetContents now always routes through FileGetContentsJitHelper → VmFs::fileGetContents()
via JitVmHelperLink, matching the Unlink pattern (#19186).

- Delete ext/standard/JitFileGetContentsKernel.php (185 lines removed)
- Remove UserScriptAotDeferNestedJit defer path from StringFileGetContents
- Remove implementUserScriptKernel() method entirely
- Remove kernel from spine require list; add mb_strstr.php (sync fix for #19942)
- Update FileGetContentsRuntimeShrinkTest to assert kernel deletion
- Regenerate bootstrap-inventory.md

Verification:
  vendor/bin/phpunit test/unit/FileGetContentsRuntimeShrinkTest.php — OK (4 tests, 16 assertions)
  make bootstrap-selfhost-vm-driver-execute-probe — OK
  php script/bootstrap-inventory.php --check — OK 5330/5330
  php script/check-selfhost-spine-coverage-sync.php — OK

Closes #19339

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_strstr() missing — undefined function fatal (ext/mbstring/mbstring.c)

1 participant