Skip to content

Stdlib: IntlCalendar / IntlTimeZone — ext/intl calendar OOP missing (ext/intl/calendar) #6151

Description

@PurHur

Category

stdlib

Problem

Zend ext/intl exposes IntlCalendar and IntlTimeZone for locale-aware calendar math (field get/set, roll, add, timezone rules). This compiler has an ext/intl skeleton (#5925, #5747, #5201) but no calendar classes — class_exists('IntlCalendar') and class_exists('IntlTimeZone') are false under bin/vm.php.

Scheduling, i18n date pickers, and ICU-based calendar conversions depend on this API (distinct from procedural date() / DateTime in #3072).

php-src reference

Repro (failure today)

<?php
var_export(class_exists('IntlCalendar'));
echo "\n";
var_export(class_exists('IntlTimeZone'));
echo "\n";
$cal = IntlCalendar::createInstance(null, 'en_US');
echo $cal->get(IntlCalendar::FIELD_YEAR), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro_intl_calendar.php    # false/false if ext/intl absent in image; true + year if built
php bin/vm.php repro_intl_calendar.php
'
Runtime class_exists('IntlCalendar') createInstance
Zend (ext/intl) true object + field year
VM today false compile/runtime fatal — class unknown

Scope (this repo) — v1 subset

Module Path
Extension ext/intl/IntlCalendar.php, IntlTimeZone.php, Module.php registration
VM OOP thin wrappers; v1 may delegate field math to host ICU behind VmIntl guard or port minimal Gregorian rules in PHP
Constants IntlCalendar::FIELD_*, DOW_*, MONTH_*
Tests test/compliance/cases/ext/intl_calendar_basic.phpt
Matrix script/capability-matrix.php

Defer IntlGregorianCalendar, IntlBreakIterator integration, and full ICU timezone rule DB to phase 2. Coordinate with #3336 umbrella and #5201 date formatter.

PHP-in-PHP: prefer PHP class implementations in ext/intl/; no permanent C calendar tables in runtime/.

Done when

  • IntlCalendar + IntlTimeZone registered; class_exists true on VM
  • v1: createInstance, get/set on FIELD_YEAR/FIELD_MONTH/FIELD_DAY_OF_MONTH, getTimeZone — repro prints sensible year
  • Compliance PHPT documents ICU/host dependency if v1 delegates
  • ./script/ci-fast.sh --filter IntlCalendar green (or @group intl skip documented)

Links

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