Skip to content

Stdlib: timezone_identifiers_list() and date timezone introspection (ext/date parity) #3504

Description

@PurHur

Category

stdlib

Problem

Procedural timezone discovery helpers from ext/date are missing. #3072 landed DateTime / DateTimeZone OOP on VM; #3292 tracks strtotime / date_default_timezone_*. Frameworks and config loaders also call:

  • timezone_identifiers_list()
  • timezone_name_from_abbr()
  • timezone_abbreviations_list()
  • date_sunrise() / date_sunset() (procedural sun times)

All function_exists() probes return false today.

php-src reference

  • ext/date/php_date.c — PHP_FUNCTION(timezone_identifiers_list), timezone_name_from_abbr, timezone_abbreviations_list
  • ext/date/php_date.c — PHP_FUNCTION(date_sunrise), PHP_FUNCTION(date_sunset)
  • ext/date/lib/timelib.c — timezone database (timelib_timezone_list, sun calc)
  • ext/date/php_datetime.c — shared timezone DB with OOP layer (Stdlib: DateTime / DateTimeImmutable OOP (ext/date parity) #3072)

Repro (today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
foreach ([\"timezone_identifiers_list\",\"timezone_name_from_abbr\",\"date_sunrise\"] as \$fn) {
  echo \$fn, \": \", function_exists(\$fn) ? \"yes\" : \"no\", \"\\n\";
}
echo timezone_identifiers_list()[0], \"\\n\";
"'

Zend PHP: all three yes; first identifier e.g. Africa/Abidjan
This compiler: all no; fatal Call to undefined function timezone_identifiers_list()

Scope (this repo)

Area Path
Builtins ext/date/timezone_identifiers_list.php (new module or extend ext/standard/VmDate.php)
Host bridge Reuse host DateTimeZone::listIdentifiers() / timelib-equivalent for v1 (same strategy as #3072)
Constants Share DATE_SUNRISE_* / DATE_SUNSET_* with procedural sun functions
Tests test/compliance/cases/stdlib/timezone_identifiers.phpt, date_sunrise_basic.phpt
Matrix script/capability-matrix.php

v1: full identifier list + date_sunrise/date_sunset with lat/long/timestamp; defer timezone_abbreviations_list edge cases if needed.

Done when

  • timezone_identifiers_list() returns non-empty array containing UTC
  • date_sunrise() for fixed lat/long/timestamp matches Zend within 1 second
  • ./script/ci-fast.sh --filter timezone_identifiers green
  • Document VM-only JIT/AOT column in matrix (phase 1)

Related

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 May 30, 2026
  2. PurHur commented on Jun 12, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. PurHur commented on Jun 12, 2026

    @PurHur
    OwnerAuthor

    Merged via #8085.

    Verification
    ```bash
    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
    foreach (["timezone_identifiers_list","date_sunrise"] as $fn) {
    echo $fn, ": ", function_exists($fn) ? "yes" : "no", "\n";
    }
    echo timezone_identifiers_list()[0], "\n";
    "'

    timezone_identifiers_list: yes / Africa/Abidjan

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter timezone_identifiers'

    OK (2 tests)

    ```

    timezone_name_from_abbr() / timezone_abbreviations_list() remain open on this issue for a follow-up.

  4. PurHur commented on Jun 12, 2026

    @PurHur
    OwnerAuthor

    Merged via #8089 — timezone_identifiers_list() JIT/AOT lowering via compile-time list baking (JitTimezoneIdentifiersList + VmDateTimeNative). Verification: vendor/bin/phpunit --filter timezone_identifiers_list_jit OK (2 tests); php bin/compile.php -l test/fixtures/aot/compile-only/timezone_identifiers_list.php exit 0; JIT compile probe jitCompileBlock OK.

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