Skip to content

Stdlib: locale_get_default()/Locale without ext/intl — function_exists true, Zend false (ext/intl/php_intl.c, re-#9576) #16214

Description

@PurHur

Category

stdlib · php-src-strict

Problem

Zend only registers locale_get_default(), locale_set_default(), and class Locale when ext/intl is loaded. On a typical CLI build without intl, function_exists('locale_get_default') is false. This compiler always exposes the symbols (VM-first #9576), so portable function_exists guards mis-detect intl availability.

Repro Zend 8.2 (no intl) VM (2026-07-04)
function_exists('locale_get_default') false true
class_exists('Locale') false true

Same class of bug as #11825 (grapheme_* without intl).

php-src reference

PHP implementation target

  • ext/intl/Module.php — gate registration on intl/ICU availability flag matching Zend
  • ext/intl/locale_get_default.php, Locale.php — keep PHP implementations; hide symbols when gated
  • lib/VM/Reflection / function_exists path — respect module gate (no permanent stubs visible without intl)

Repro

./script/docker-exec.sh -- bash -lc 'php -r "var_export(function_exists('"'"'locale_get_default'"'"'));"'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "var_export(function_exists('"'"'locale_get_default'"'"'));"'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_locale_get_default.php'

Done when

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machineenhancementNew feature or requestimplementation-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