Skip to content

Stdlib: DateTimeZone invalid id — must throw DateInvalidTimeZoneException not E_WARNING (ext/date/php_date.c, pairs #6048) #7279

Description

@PurHur

Category

stdlib | php-src-strict | ext/date

Problem

On unknown timezone identifiers, Zend PHP 8.3+ throws DateInvalidTimeZoneException (subclass of DateException, see #6048). This compiler emits only DateTimeZone::__construct(): Unknown or bad timezone (...) as E_WARNING — catch (DateInvalidTimeZoneException $e) never runs.

Behavior
Zend 8.3+ new DateTimeZone('Not/A/Timezone') → DateInvalidTimeZoneException
VM warning only; object may still construct

php-src reference

Repro

test/repro/maintainer-date-timezone-exception-throw.php:

./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer-date-timezone-exception-throw.php
# DateInvalidTimeZoneException: no / warning only

Scope

Path Work
ext/date/DateTimeZone.php (or handler) On invalid identifier, throw new DateInvalidTimeZoneException(...) after #6048 registers class
date_default_timezone_set() Same exception for invalid ids (#4634)
Tests Compliance: invalid id throws; valid id succeeds

PHP-in-PHP first — throw from ext/date/ handler; no new C paths.

Done when

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