Skip to content

Regression: ResourceBundle::create() missing bundle returns object — Zend NULL + U_MISSING_RESOURCE_ERROR (ext/intl/resourcebundle) #22902

Description

@PurHur

Category

bug · php-src-strict · ResourceBundle construct failure

Problem

When the ICU bundle/locale cannot be loaded and $fallback is false, Zend returns null and sets intl_get_error_code() to U_MISSING_RESOURCE_ERROR (2). VM returns an empty ResourceBundle object with intl_get_error_code()===0. Distinct from #22854 (fallback locale U_USING_DEFAULT_WARNING).

Repro (ResourceBundle::create($loc, $bundle, false)) Zend 8.2+ VM (2026-07-24)
xx_YY / ICUDATA-zone NULL, err=2 (U_MISSING_RESOURCE_ERROR) ResourceBundle object, err=0
zz_ZZ / ICUDATA NULL, err=2 object, err=0
en / no_such_bundle_xyz NULL, err=2 non-object / inconsistent

php-src reference

PHP implementation target

  • ext/intl/ ResourceBundle create path (VmResourceBundle / construct helper) — on open failure with $fallback=false, return null, set intl error code/message like Zend; do not publish empty object
  • PHP-in-PHP; no new C

Repro

./script/docker-exec.sh -- bash -lc 'cat >/tmp/rb_missing.php <<'"'"'PHP'"'"'
<?php
$r = @ResourceBundle::create("xx_YY", "ICUDATA-zone", false);
echo $r === null ? "NULL" : ("OBJ:".get_class($r));
echo " err=", intl_get_error_code(), " msg=", intl_get_error_message(), "\n";
PHP
php /tmp/rb_missing.php
php bin/vm.php /tmp/rb_missing.php'

Done when

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions