Skip to content

Regression: IntlDateFormatter locale @calendar=hebrew/islamic/japanese/buddhist — formats Gregorian (ext/intl/dateformat) #22877

Description

@PurHur

Category

bug · php-src-strict · IntlDateFormatter calendar locale keyword

Problem

Constructing IntlDateFormatter with locale en_US@calendar=<non-gregorian> and IntlDateFormatter::TRADITIONAL must format using that calendar. VM ignores the @calendar keyword and emits Gregorian (or time-only) output.

Repro (format(0), FULL date, NONE time, UTC, TRADITIONAL) Zend 8.2+ VM (2026-07-24)
en_US@calendar=hebrew Thursday, 23 Tevet 5730 Gregorian / time-only (not Hebrew)
en_US@calendar=islamic Thursday, Shawwal 23, 1389 AH not Islamic
en_US@calendar=japanese Thursday, January 1, 45 Shōwa not Japanese era
en_US@calendar=buddhist Thursday, January 1, 2513 BE not Buddhist era

php-src reference

PHP implementation target

  • ext/intl/VmIntlDateFormatter.php — honor @calendar= in locale when calendar arg is TRADITIONAL (and when unset defaults follow locale); wire through format path
  • Prefer PHP-in-PHP ICU bindings already used elsewhere; no new runtime/*.c logic

Repro

cat > /tmp/idf_cal.php <<'PHP'
<?php
foreach (['hebrew','islamic','japanese','buddhist'] as $cal) {
  $df = new IntlDateFormatter(
    \"en_US@calendar=$cal\",
    IntlDateFormatter::FULL,
    IntlDateFormatter::NONE,
    'UTC',
    IntlDateFormatter::TRADITIONAL
  );
  echo \"$cal: \" . $df->format(0) . \"\n\";
}
PHP
./script/docker-exec.sh -- bash -lc 'php /tmp/idf_cal.php; php bin/vm.php /tmp/idf_cal.php'

Host-confirmed (2026-07-24, master b076674e2).

Done when

  • Each @calendar= locale above matches Zend date string family (era/month names)
  • Compliance .phpt under test/compliance/cases/intl/
  • php-src-strict; no php-compiler-strict shortcut

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