Skip to content

mbstring: mb_detect_encoding() VM parity (#3075) - #17848

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-3075-mb-detect-encoding
Jul 11, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-3075-mb-detect-encoding

Conversation

@PurHur

@PurHur PurHur commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement mb_detect_encoding() in ext/mbstring/ via VmMbstring::detectEncoding() — php-src ext/mbstring/mbstring.c UTF-8 preference when valid multibyte UTF-8 competes with ISO-8859-1 in the candidate list.
  • Register builtin in ext/mbstring/Module.php; completes the remaining slice of Stdlib: mb_convert_encoding / mb_detect_encoding (ext/mbstring parity) #3075 alongside existing mb_convert_encoding().
  • Add compliance .phpt, maintainer repro, and spine require for ext/mbstring/mb_detect_encoding.php (inventory 4403/4404).

php-src reference

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

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_gap_mb_detect_encoding.php
vendor/bin/phpunit --filter mb_detect_encoding
php script/check-selfhost-spine-coverage-sync.php
'
ISO-8859-1
ISO-8859-1
ok
OK (2 tests, 2 assertions)
check-selfhost-spine-coverage-sync: OK (spine covers all 4404 inventory files)

Closes #3075

Made with Cursor

Add mb_detect_encoding() with Zend-aligned UTF-8 preference when valid
multibyte UTF-8 competes with ISO-8859-1, plus compliance/repro guards
and spine coverage for self-host inventory sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit e5df34b into master Jul 11, 2026
@PurHur
PurHur deleted the agent/issue-3075-mb-detect-encoding branch July 11, 2026 02: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.

Stdlib: mb_convert_encoding / mb_detect_encoding (ext/mbstring parity)

1 participant