Skip to content

Stdlib: timezone_open() — procedural DateTimeZone factory (#4634) - #8266

Merged
PurHur merged 1 commit into
masterfrom
agent/stdlib-timezone-open-4634
Jun 13, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/stdlib-timezone-open-4634

Conversation

@PurHur

@PurHur PurHur commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement timezone_open() in ext/standard/timezone_open.php (php-src ext/date/php_date.c — PHP_FUNCTION(timezone_open)).
  • VM allocates via DateTimeSupport::newDateTimeZoneVariable(); invalid ids emit warning and return false (Zend parity).
  • JIT/AOT: JitTimezoneOpen lowers compile-time timezone string literals to DateTimeZone objects with __dt_timezone_name set.

Closes #4634

php-src reference

  • ext/date/php_date.c — PHP_FUNCTION(timezone_open)

Verification

docker info >/dev/null
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro/timezone_open.php
php bin/vm.php test/repro/timezone_open.php
php bin/jit.php test/repro/timezone_open.php
php bin/compile.php -l test/repro/timezone_open.php
vendor/bin/phpunit --filter timezone_open
'

Output:

bool(true)
bool(true)
bool(true)
UTC
Europe/Berlin

PHPUnit: OK (4 tests, 4 assertions)

Made with Cursor

php-src ext/date/php_date.c maps timezone_open() to DateTimeZone construction;
VM uses DateTimeSupport::newDateTimeZoneVariable with warning+false on invalid ids.
JIT lowers compile-time timezone literals via JitTimezoneOpen.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant