Category
stdlib · php-src-strict
Problem
Encoding configuration builtins from ext/mbstring are missing. Frameworks read/set internal encoding and language at bootstrap (mb_internal_encoding('UTF-8'), mb_language('uni')). Without these, multibyte pipelines cannot mirror Zend defaults.
Verified 2026-06-19: function_exists('mb_internal_encoding') → false on bin/vm.php. mb_strlen / mb_substr / mb_trim exist but cannot follow Zend encoding state until this lands.
Blocks (downstream)
| Issue |
Symptom without mb_internal_encoding |
| #9977 |
mb_trim($s, characters: '-') after mb_internal_encoding('UTF-8') |
| #9208 |
Full mb_ltrim/mb_rtrim UTF-8 mask repro |
| #6548 |
mb_send_mail charset negotiation |
php-src reference
Repro (failure today)
<?php
var_dump(function_exists('mb_internal_encoding'));
echo mb_internal_encoding(), "\n";
mb_internal_encoding('UTF-8');
echo mb_internal_encoding(), "\n";
var_dump(mb_language());
var_dump(mb_http_input());
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro_mb_internal_encoding.php
php bin/vm.php repro_mb_internal_encoding.php
'
| Runtime |
First mb_internal_encoding() |
| Zend |
e.g. UTF-8 |
| This compiler |
undefined function ❌ |
Encoding propagation probe (done-when guard)
<?php
mb_internal_encoding('UTF-8');
$s = ' üñîçø∂é ';
var_dump(mb_strlen($s));
var_dump(mb_trim($s));
Scope (PHP-in-PHP first)
| Path |
Work |
ext/mbstring/VmMbstring.php |
Store/retrieve internal encoding + language in PHP state |
ext/mbstring/mb_internal_encoding.php |
Builtin registration (getter/setter) |
ext/mbstring/mb_language.php, mb_http_input.php |
Stub parity subset |
ext/mbstring/Module.php |
Wire functions |
ext/mbstring/mb_strlen.php, mb_trim.php, … |
Read encoding from shared state (not hard-coded UTF-8) |
| JIT/AOT |
VM-first v1; JIT calls same PHP helpers |
No new runtime/*.c — thin FFI only if ICU/libc charset probe unavoidable.
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter mb_internal_encoding'
Related
Category
stdlib· php-src-strictProblem
Encoding configuration builtins from ext/mbstring are missing. Frameworks read/set internal encoding and language at bootstrap (
mb_internal_encoding('UTF-8'),mb_language('uni')). Without these, multibyte pipelines cannot mirror Zend defaults.Verified 2026-06-19:
function_exists('mb_internal_encoding')→ false onbin/vm.php.mb_strlen/mb_substr/mb_trimexist but cannot follow Zend encoding state until this lands.Blocks (downstream)
mb_internal_encodingmb_trim($s, characters: '-')aftermb_internal_encoding('UTF-8')mb_ltrim/mb_rtrimUTF-8 mask repromb_send_mailcharset negotiationphp-src reference
ext/mbstring/mbstring.c—PHP_FUNCTION(mb_internal_encoding),mb_language,mb_http_inputext/mbstring/mbstring.stub.phpMBG(internal_encoding)inmbstring.cRepro (failure today)
mb_internal_encoding()UTF-8Encoding propagation probe (done-when guard)
Scope (PHP-in-PHP first)
ext/mbstring/VmMbstring.phpext/mbstring/mb_internal_encoding.phpext/mbstring/mb_language.php,mb_http_input.phpext/mbstring/Module.phpext/mbstring/mb_strlen.php,mb_trim.php, …No new
runtime/*.c— thin FFI only if ICU/libc charset probe unavoidable.Done when
function_exists('mb_internal_encoding')true; getter returns Zend-default encoding stringmb_internal_encoding('UTF-8')setter succeeds and changesmb_strlen/mb_trimresults on non-ASCII sample abovemb_language()get/set subset matches Zend foruni/Japanesenamesmb_http_input()returns expected string orfalseper Zend when no HTTP inputtest/compliance/cases/stdlib/mb_internal_encoding.phptgreen./script/ci-fast.sh --filter mb_internal_encodinggreencharactersparam + new builtins (ext/mbstring/mbstring.c) #9977 encoding probe (comment cross-link when green)Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter mb_internal_encoding'Related
charactersparam + new builtins (ext/mbstring/mbstring.c) #9977 mb_trim characters · Stdlib: mb_convert_encoding / mb_detect_encoding (ext/mbstring parity) #3075 convert/detect · Stdlib: mb_ereg*() — multibyte POSIX regex API (ext/mbstring/mbregex.c parity) #4635 mb_ereg · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492