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
Category
stdlib| php-src-strict | ext/dateProblem
On unknown timezone identifiers, Zend PHP 8.3+ throws
DateInvalidTimeZoneException(subclass ofDateException, see #6048). This compiler emits onlyDateTimeZone::__construct(): Unknown or bad timezone (...)as E_WARNING —catch (DateInvalidTimeZoneException $e)never runs.new DateTimeZone('Not/A/Timezone')→DateInvalidTimeZoneExceptionphp-src reference
ext/date/php_date.c—throw_date_exception(), timezone ctorext/date/php_datetime.c—date_object_new_date_timezoneRepro
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 onlyScope
ext/date/DateTimeZone.php(or handler)throw new DateInvalidTimeZoneException(...)after #6048 registers classdate_default_timezone_set()PHP-in-PHP first — throw from
ext/date/handler; no new C paths.Done when
DateInvalidTimeZoneException(requires Stdlib: DateMalformedStringException / DateInvalidTimeZoneException / DateInvalidOperationException — PHP 8.3 date exception hierarchy (ext/date) #6048 class registration)date_default_timezone_set('Bad/Zone')matches Zend failure modeRelated
DateInvalidTimeZoneExceptionDateExceptionbase classDateTimestring throw site (same pattern)timezone_open()/date_default_timezone_set()