Skip to content

Regression: IntlDateFormatter::format()/datefmt_format() reject localtime() array — false not formatted date (ext/intl/dateformat) #22870

Description

@PurHur

Category

Stdlib · php-src-strict · ext/intl dateformat

Problem

Zend’s IntlDateFormatter::format() and datefmt_format() accept an associative array from localtime($ts, true) (tm_year/tm_mon/…) and format it. On the VM both OOP and procedural entry points return false for the same array, while DateTime / Unix timestamp operands format correctly.

Repro Zend 8.2 + intl (2026-07-24) VM (2026-07-24)
$fmt->format(localtime($ts, true)) with pattern yyyy-MM-dd '2024-07-24' false
datefmt_format($fmt, localtime($ts, true)) '2024-07-24' false
$fmt->format($dt) / $fmt->format($ts) '2024-07-24' '2024-07-24' (OK)

php-src reference

PHP implementation target

  • PHP intl dateformat implementation under ext/intl/ (and any JIT lowering) — accept localtime(..., true) arrays like php-src; keep C out of runtime/
  • Share conversion helper between OOP format and datefmt_format

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r "
\$ts = strtotime(\"2024-07-24 12:00:00 UTC\");
\$fmt = datefmt_create(\"en_US\", IntlDateFormatter::SHORT, IntlDateFormatter::NONE, \"UTC\", IntlDateFormatter::GREGORIAN, \"yyyy-MM-dd\");
\$lt = localtime(\$ts, true);
var_export((new IntlDateFormatter(\"en_US\", IntlDateFormatter::SHORT, IntlDateFormatter::NONE, \"UTC\", IntlDateFormatter::GREGORIAN, \"yyyy-MM-dd\"))->format(\$lt));
echo PHP_EOL;
var_export(datefmt_format(\$fmt, \$lt));
echo PHP_EOL;
"'

Expect Zend: '2024-07-24' twice. VM today: false twice.

Done when

  • OOP + procedural format/datefmt_format match Zend for localtime($ts, true) arrays
  • DateTime / int timestamp paths stay green
  • Compliance/repro guard
  • 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