Skip to content

Fix invalid DateTimeZone id — DateInvalidTimeZoneException (#7279) - #7514

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-7279-datetimezone-invalid-exception
Jun 7, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-7279-datetimezone-invalid-exception

Conversation

@PurHur

@PurHur PurHur commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Register DateException and DateInvalidTimeZoneException in ThrowableManifest (php-src ext/date/php_date.h).
  • Replace fatal LogicException on bad timezone ids with catchable DateInvalidTimeZoneException via NativeDateInvalidTimeZoneException bridge (host PHP 8.2 lacks the native class).
  • VM implementation in lib/VM/DateTimeSupport.php; no new C runtime logic.

php-src reference

  • ext/date/php_datetimezone.c — invalid timezone id throws DateInvalidTimeZoneException

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro/maintainer_datetimezone_invalid.php'
# DateInvalidTimeZoneException: DateTimeZone::__construct(): Unknown or bad timezone (Not/A/Timezone)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/compliance/VMTest.php --filter datetimezone_invalid_id'
# OK (1 test)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/compliance/VMTest.php --filter datetime test/unit/DateTimeTest.php'
# OK (3 tests)

Closes #7279

Made with Cursor

).

Register DateException/DateInvalidTimeZoneException in ThrowableManifest and
bridge host timezone validation failures into catchable VM exceptions instead
of fatal LogicException (php-src ext/date/php_datetimezone.c).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 5b29c5c into master Jun 7, 2026
@PurHur
PurHur deleted the agent/issue-7279-datetimezone-invalid-exception branch June 7, 2026 13:59
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: DateTimeZone invalid id — must throw DateInvalidTimeZoneException not E_WARNING (ext/date/php_date.c, pairs #6048)

1 participant