-
Improvement
-
Resolution: Done
-
Minor
-
None
-
4.3.1, 4.4
-
MOODLE_403_STABLE, MOODLE_404_STABLE
https://php.watch/versions/8.3/datetime-exceptions
In PHP 8.3, the Date/Time extension introduces extension-specific and granular Exception and Error classes to better convey the error and exception states. This makes it easier and cleaner to catch date-specific exceptions.
Prior to PHP 8.3, the Date/Time extension used standard \Exception and \Error.
The new Exception/Error classes extend existing \Error and \Exception classes, which means existing code that catch \Exception or \Error exceptions should continue to catch these errors.
More info:
https://stitcher.io/blog/new-in-php-83#more-appropriate-date/time-exceptions-rfc-breaking
In general, these additions won't break any code, since these newly added exceptions and errors subclass the generic Exception and Error classes. However, there are three small breaking changes that come with this RFC:
- The Epoch doesn't fit in a PHP integer now returns a new DateRangeError instead of a generic ValueError, which it does not subclass. This is only an issue for 32-bit platforms.
- The Only non-special relative time specifications are supported for subtraction warning with DateTime::sub() and date_sub() becomes a new DateInvalidOperationException.
- The Unknown or bad format (%s) at position %d (%c): %s and String '%s' contains non-relative elements warnings that are created while parsing wrong/broken DateInterval strings will now throw a new DateMalformedIntervalStringException when used with the OO interface, instead of showing a warning and returning false.
Required
- We do not support 32-bit platforms any more
- We do not have any usage of date_sub()
- We cannot detect the third instance in any way that I can think of.
- Confirm Andrew's assessment that no change is required
- has a non-specific relationship to
-
MDL-80144 Validation only: Confirm a collection of PHP 8.3 issues are no-op
-
- Closed
-