Skip to content

Stdlib: IntlDateFormatter::formatObject()/datefmt_format_object() missing (ext/intl/dateformat) #20813

Closed

Description

@PurHur

Category

stdlib · php-src-strict · ext/intl IntlDateFormatter

Problem

VM has IntlDateFormatter::format / parse / localtime (and related) under PROFILE=8.4, but php-src IntlDateFormatter::formatObject() (static) and procedural datefmt_format_object() are missing — method_exists / function_exists false; call throws undefined method. Distinct from #20803 (procedural parse/localtime/error) and #20740 (IntlDatePatternGenerator).

Repro Zend (intl) VM PROFILE=8.4 (2026-07-19)
method_exists(IntlDateFormatter::class, 'formatObject') true false
function_exists('datefmt_format_object') true false
IntlDateFormatter::formatObject(new DateTime('2024-01-15'), [IntlDateFormatter::SHORT, IntlDateFormatter::NONE], 'en_US') locale short date string Error: Call to undefined static method

php-src reference

PHP implementation target

  • Implement in ext/intl/ + VmIntlDateFormatter (PHP-in-PHP), register static method + procedural alias in Module.php
  • No new C in runtime/

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
cat > /tmp/datefmt_format_object_gap.php << "PHP"
<?php
$dt = new DateTime("2024-01-15 12:00:00", new DateTimeZone("UTC"));
echo "method=" . (method_exists(IntlDateFormatter::class, "formatObject") ? "yes" : "no") . "\n";
echo "fn=" . (function_exists("datefmt_format_object") ? "yes" : "no") . "\n";
try {
  echo "r=" . IntlDateFormatter::formatObject($dt, [IntlDateFormatter::SHORT, IntlDateFormatter::NONE], "en_US") . "\n";
} catch (Throwable $e) {
  echo "err=" . get_class($e) . ": " . $e->getMessage() . "\n";
}
PHP
PHP_COMPILER_PROFILE=8.4 php bin/vm.php /tmp/datefmt_format_object_gap.php'

Done when

  • formatObject / datefmt_format_object registered under PROFILE=8.4
  • Output matches Zend intl for DateTime / IntlCalendar object inputs (date-style / time-style array and pattern-string forms)
  • Compliance under test/compliance/cases/intl/; php-src-strict

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 19, 2026
  2. PurHur commented on Jul 19, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (#20756 → #20740 → #20813 → #20809 → #20810). Starting with #20756 IntlCalendar methods.

  3. PurHur commented on Jul 19, 2026

    @PurHur
    OwnerAuthor

    merged: #20825

    Verification (after rebase onto master)

    • VM repro → method/fn yes; arr/proc/pat/cal match Zend
    • vendor/bin/phpunit --filter intl_datefmt_format_object → OK (VM+JIT)

    Next: #20809 MessageFormatter::__construct, then #20810 grapheme_strchr*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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