Skip to content

Regression: IntlTimeZone::createTimeZone unknown ID returns GMT/UTC — Zend Etc/Unknown (ext/intl/timezone) #25356

Description

@PurHur

Category

stdlib · php-src-strict · intl timezone

Problem

IntlTimeZone::createTimeZone($id) for an unrecognized zone does not match Zend/php-src:

  1. Unknown ID (e.g. No/Such) — Zend returns an IntlTimeZone whose getID() is Etc/Unknown; VM returns GMT.
  2. Empty string '' — Zend → Etc/Unknown; VM → default TZ (UTC on this host).

VmIntlTimeZone::resolveTimezoneId() currently documents “unknown IDs become GMT”, but that does not match Zend 8.2 / current php-src ICU sentinel behavior (TimeZone::getUnknown()Etc/Unknown).

Verified 2026-07-30 (host Zend 8.2.32 vs bin/vm.php on master):

Repro Zend 8.2 getID() VM getID()
IntlTimeZone::createTimeZone('No/Such') Etc/Unknown GMT
IntlTimeZone::createTimeZone('') Etc/Unknown UTC (default TZ)
IntlTimeZone::createTimeZone('America/New_York')->getID() America/New_York America/New_York (ok)

php-src reference

PHP implementation target

  • ext/intl/VmIntlTimeZone.phpresolveTimezoneId() / createTimeZone path: map empty + unknown IDs to Etc/Unknown (same object shape as getUnknown()), not GMT / defaultTimezoneGet()
  • Align any intl error code/message with php-src for the unknown-ID case
  • Prefer PHP-in-PHP; no new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php -r '\''
$z = IntlTimeZone::createTimeZone("No/Such");
echo $z->getID(), "\n";
$e = IntlTimeZone::createTimeZone("");
echo $e->getID(), "\n";
'\'' && php bin/vm.php -r '\''
$z = IntlTimeZone::createTimeZone("No/Such");
echo $z->getID(), "\n";
$e = IntlTimeZone::createTimeZone("");
echo $e->getID(), "\n";
'\'''

Done when

  • Unknown / empty ID → getID() === 'Etc/Unknown' on VM (and JIT/AOT if in scope)
  • Valid IDs unchanged
  • Compliance .phpt under test/compliance/cases/ for intl timezone
  • php-src-strict; no php-compiler-strict shortcut

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 machinebugSomething isn't workingimplementation-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