Category
stdlib · php-src-strict · ext/intl ResourceBundle · pillar 4
Problem
ResourceBundle::create() / get() / count() landed in #6187, but php-src’s locale enumeration and last-error accessors are still absent. Apps that list bundle locales or check getErrorCode() after a failed get() fatal instead.
| Repro |
Zend (intl) |
VM PROFILE=8.4 (2026-07-18) |
method_exists(ResourceBundle::class, 'create') |
true |
true |
method_exists(..., 'getLocales') |
true |
false |
$b->get / count |
works |
works |
$b->getErrorCode() / getErrorMessage() |
works |
undefined method |
$b->getIterator() |
works |
undefined method |
php-src reference
PHP implementation target
- Extend
ext/intl/VmResourceBundle.php — PHP-in-PHP; reuse existing ICU ures_* FFI for locales/errors where needed, keep create/get/count paths shared
- Register static
getLocales + instance error/iterator methods next to ResourceBundleCreate / Get / Count
Repro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/vm.php -r "
echo \"getLocales=\",(method_exists(ResourceBundle::class,\"getLocales\")?\"1\":\"0\"),PHP_EOL;
\$b=ResourceBundle::create(\"en\",\"ICUDATA\");
foreach ([\"getErrorCode\",\"getErrorMessage\",\"getIterator\"] as \$n) echo \$n,\"=\",(method_exists(\$b,\$n)?\"1\":\"0\"),PHP_EOL;
try { var_export(ResourceBundle::getLocales(\"ICUDATA\")); echo PHP_EOL; }
catch (Throwable \$e) { echo get_class(\$e),\": \",\$e->getMessage(),PHP_EOL; }
"'
Done when
Category
stdlib· php-src-strict · ext/intl ResourceBundle · pillar 4Problem
ResourceBundle::create()/get()/count()landed in #6187, but php-src’s locale enumeration and last-error accessors are still absent. Apps that list bundle locales or checkgetErrorCode()after a failedget()fatal instead.method_exists(ResourceBundle::class, 'create')truetruemethod_exists(..., 'getLocales')truefalse$b->get/count$b->getErrorCode()/getErrorMessage()$b->getIterator()php-src reference
ext/intl/resourcebundle/resourcebundle.stub.php—getLocales/getErrorCode/getErrorMessage/getIteratorext/intl/resourcebundle/resourcebundle_class.c—resourcebundle_locales/ error gettersPHP implementation target
ext/intl/VmResourceBundle.php— PHP-in-PHP; reuse existing ICUures_*FFI for locales/errors where needed, keep create/get/count paths sharedgetLocales+ instance error/iterator methods next toResourceBundleCreate/Get/CountRepro
Done when
getLocalesreturns a non-empty list (or Zend-equivalent false) forICUDATAgetErrorCode/getErrorMessagematch Zend/intl error semantics.phptundertest/compliance/cases/intl/