Skip to content

Stdlib: Locale::getDisplayName()/getDisplayLanguage()/getDisplayRegion() ignore $displayLocale — always English (ext/intl/locale) #22901

Description

@PurHur

Category

bug · php-src-strict · Locale display names

Problem

VmLocale::getDisplayName / getDisplayLanguage / getDisplayRegion explicitly unset($displayLocale) and return a fixed English approximation. Zend uses ICU uloc_getDisplayName (etc.) so Locale::getDisplayName('en_US', 'fr') is French. Keyword display APIs already call ICU; name/language/region/script/variant still stub English.

Repro Zend 8.2+ VM (2026-07-24)
Locale::getDisplayName('en_US', 'fr') anglais (États-Unis) English (United States)
Locale::getDisplayLanguage('en_US', 'fr') anglais English
Locale::getDisplayRegion('en_US', 'fr') États-Unis United States

php-src reference

PHP implementation target

  • ext/intl/VmLocale.php — wire getDisplayName/getDisplayLanguage/getDisplayRegion/getDisplayScript/getDisplayVariant through ICU like getDisplayKeyword* (reuse ulocDisplay* FFI path)
  • PHP-in-PHP; thin ICU ABI only if already used for keywords

Repro

./script/docker-exec.sh -- bash -lc 'cat >/tmp/locale_display_fr.php <<'"'"'PHP'"'"'
<?php
echo Locale::getDisplayName("en_US", "fr"), "\n";
echo Locale::getDisplayLanguage("en_US", "fr"), "\n";
echo Locale::getDisplayRegion("en_US", "fr"), "\n";
PHP
php /tmp/locale_display_fr.php
php bin/vm.php /tmp/locale_display_fr.php'

Done when

  • $displayLocale changes output to match Zend/ICU for name/language/region (and script/variant if in scope)
  • Default/null display locale still sensible vs Zend
  • Compliance .phpt; php-src-strict

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