Skip to content

Stdlib: timezone_open() / date_default_timezone_get() / date_default_timezone_set() — procedural ext/date (php_date.c parity) #4634

Description

@PurHur

Category

stdlib

Problem

Procedural timezone helpers from ext/date are missing. DateTime / DateTimeZone OOP exists on VM (#3072), but scripts that use the procedural API (timezone_open(), default timezone getters/setters) fail with undefined function.

Zend maps timezone_open() to DateTimeZone construction; default timezone functions back date() / time() formatting.

php-src reference

Repro (failure today)

<?php
var_dump(function_exists('timezone_open'));
var_dump(function_exists('date_default_timezone_get'));
$tz = timezone_open('UTC');
var_dump($tz instanceof DateTimeZone);
echo date_default_timezone_get(), "\n";
date_default_timezone_set('Europe/Berlin');
echo date_default_timezone_get(), "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php'
Runtime timezone_open date_default_timezone_get
Zend DateTimeZone object current TZ id string
This compiler undefined function undefined function

Scope (this repo)

Area Path
VM Reuse lib/VM/DateTimeSupport.php + DateTimeZone builtins from #3072
Builtins ext/date/timezone_open.php (or ext/standard/) + default TZ wrappers
Register ext/standard/Module.php or dedicated ext/date/Module.php
JIT/AOT VM-first v1 (same as DateTime phase 1); separate JIT issue if needed
Tests test/compliance/cases/stdlib/timezone_open.phpt, date_default_timezone.phpt

Done when

  • timezone_open('UTC') returns a DateTimeZone instance usable by DateTime::__construct
  • date_default_timezone_get() / date_default_timezone_set() round-trip matches Zend for named zones
  • Invalid timezone id → DateTimeZone constructor exception parity
  • ./script/ci-fast.sh --filter timezone_open green
  • Capability matrix rows added via script/capability-matrix.php

Related

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