Skip to content

Stdlib: ext/intl — IntlDateFormatter create/format (ext/intl/dateformat) #5201

Description

@PurHur

Category

stdlib

Problem

There is no ext/intl in this repo. Zend exposes IntlDateFormatter (datefmt_create, format, locale/timezone) via ICU. Web and CLI code using localized date formatting fails with missing class/function.

php-src reference

Repro (failure today)

<?php
$fmt = IntlDateFormatter::create(
    'en_US',
    IntlDateFormatter::SHORT,
    IntlDateFormatter::SHORT,
    null,
    IntlDateFormatter::GREGORIAN,
    'yyyy-MM-dd'
);
echo $fmt->format(new DateTime('2020-01-15 12:00:00'));
docker info >/dev/null
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php
'
Check Zend PHP 8.2 (icu) bin/vm.php (today)
class_exists('IntlDateFormatter') true false
format(DateTime) localized string (e.g. 1/15/20) fatal / missing class

Scope (this repo)

Layer Path Notes
Module ext/intl/Module.php (new) Register class + IntlDateFormatter::* int constants
Class ext/intl/IntlDateFormatter.php PHP-first; ICU via thin FFI to ucal_* only if unavoidable — document in PR
Wire lib/VM/BuiltinClasses.php, loader next to ext/standard/Module.php
DateTime Depends on #5120 DateTime OOP surface
Tests test/compliance/cases/stdlib/intl_dateformatter_short.phpt
Matrix script/capability-matrix.php row

Out of scope: NumberFormatter (#5154), Normalizer (#5153), intl_get_error_* (#5156).

Done when

  • Repro: IntlDateFormatter::create('en_US', SHORT, SHORT, …) returns object on VM
  • format(new DateTime('2020-01-15')) matches Zend output for en_US SHORT/SHORT (normalize whitespace in test)
  • class_exists('IntlDateFormatter') true when ext enabled
  • ./script/ci-fast.sh --filter intl_dateformatter green
  • Capability matrix updated via script/capability-matrix.php

Links

#5154, #5156, #5120, #1492

Activity

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 apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions