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
Category
Stdlib· php-src-strict · ext/intl dateformatProblem
Zend’s
IntlDateFormatter::format()anddatefmt_format()accept an associative array fromlocaltime($ts, true)(tm_year/tm_mon/…) and format it. On the VM both OOP and procedural entry points returnfalsefor the same array, whileDateTime/ Unix timestamp operands format correctly.$fmt->format(localtime($ts, true))with patternyyyy-MM-dd'2024-07-24'falsedatefmt_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
ext/intl/dateformat/dateformat_format.c—intl_datetime_decompose/ localtime array handlingext/intl/dateformat/dateformat_attr.c— format attribute pathlocaltime()method), not thisformat($localtimeArray)operandPHP implementation target
ext/intl/(and any JIT lowering) — acceptlocaltime(..., true)arrays like php-src; keep C out ofruntime/formatanddatefmt_formatRepro
Expect Zend:
'2024-07-24'twice. VM today:falsetwice.Done when
format/datefmt_formatmatch Zend forlocaltime($ts, true)arrays