rfc:datetime-exceptions
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:datetime-exceptions [2022/11/29 17:35] – Ccreated the RFC derick | rfc:datetime-exceptions [2023/02/08 10:43] (current) – Mark as implemented derick | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: More Appropriate Date/Time Exceptions ====== | ====== PHP RFC: More Appropriate Date/Time Exceptions ====== | ||
- | * Version: 0.9 | + | * Version: 0.9.1 |
- | * Date: 2022-11-29 | + | * Date: 2022-12-15 (First created: 2022-11-29) |
* Author: Derick Rethans < | * Author: Derick Rethans < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 11: | Line 11: | ||
This RFC proposes to introduce Date/Time extension specific exceptions and errors where this makes sense. | This RFC proposes to introduce Date/Time extension specific exceptions and errors where this makes sense. | ||
- | Right now, they are either warnings/ | + | Right now, they are either warnings/ |
+ | Out of scope of this RFC is changing and improving warning, Error, and Exception messages. | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | The proposals | + | The proposal |
The rationale behind all of these is the following: | The rationale behind all of these is the following: | ||
Line 31: | Line 32: | ||
* Errors with parsing the free-form text to create a '' | * Errors with parsing the free-form text to create a '' | ||
- | The hierarchy | + | The hierarchy will look like: |
- | will look like: | + | |
* Error | * Error | ||
* ''" | * ''" | ||
- | * ''" | + | * ''" |
- | * ''" | + | * ''" |
- | * ''" | + | * ''" |
- | * ''" | + | * ''" |
* ''" | * ''" | ||
* ''" | * ''" | ||
Line 73: | Line 73: | ||
* ''" | * ''" | ||
* ''" | * ''" | ||
- | * DateMalformedPeriodStringException (all DatePeriod, __construct) | + | * DateMalformedPeriodStringException (all DatePeriod's constructor) |
* ''" | * ''" | ||
* ''" | * ''" | ||
Line 80: | Line 80: | ||
* ''" | * ''" | ||
- | Procedural style use of date/time functions | + | Procedural style use of date/time functions |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | - The warning for broken serialisation data becomes a new '' | + | |
- | - The ''" | + | - The ''" |
- | - The '' | + | - The ''" |
- | | + | |
- | * Date: 2022-11-29 | + | |
- | * Author: Derick Rethans < | + | |
- | * Status: Draft | + | |
- | * First Published at: http:// | + | |
- | + | ||
- | + | ||
- | ===== Introduction ===== | + | |
- | + | ||
- | This RFC proposes to introduce Date/Time extension specific exceptions and errors where this makes sense. | + | |
- | + | ||
- | Right now, they are either warnings/ | + | |
- | + | ||
- | + | ||
- | ===== Proposal ===== | + | |
- | + | ||
- | The proposals is to reclassify warnings and errors as Exceptions, and introduce Date extension specific exceptions and errors. | + | |
- | + | ||
- | The rationale behind all of these is the following: | + | |
- | + | ||
- | * Common errors (such as modifying readonly properties and invalid serialisation data) will throw an '' | + | |
- | * Programming errors that do not come forth from user input, or free form text, become a '' | + | |
- | * Corrupted data (such as an invalid Timezone Database) becomes a '' | + | |
- | * Uninitialised objects (due to a child not calling '' | + | |
- | * Issues that come to light due to user input, or free form text arguments that need to be parsed, become specific '' | + | |
- | * Errors with timezone creation cause an '' | + | |
- | * Errors that come forth out of operations that can not be executed (such as using a non-special relative time specification with '' | + | |
- | * Errors with parsing the free-form text to create a '' | + | |
- | * Errors with parsing the free-form text to create a '' | + | |
- | * Errors with parsing the free-form text to create a '' | + | |
- | + | ||
- | The hierarchy | + | |
- | will look like: | + | |
- | + | ||
- | * Error | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ValueError (all, already like this) | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * TypeError | + | |
- | * ''" | + | |
- | * DateError | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * DateObjectError | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * DateRangeError (is currently a ValueError) | + | |
- | * ''" | + | |
- | * Exception | + | |
- | * DateException | + | |
- | * DateInvalidTimeZoneException (these are not easy to just change/ | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * DateInvalidOperationException | + | |
- | * ''" | + | |
- | * DateMalformedStringException | + | |
- | * '' | + | |
- | * DateMalformedIntervalStringException | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * DateMalformedPeriodStringException (all DatePeriod, __construct) | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | * ''" | + | |
- | + | ||
- | Procedural style use of date/time functions are not effected, and will continue to use warnings and errors as they currently do. | + | |
- | + | ||
- | ===== Backward Incompatible Changes ===== | + | |
- | + | ||
- | - The warning for broken serialisation data becomes a new '' | + | |
- | - The ''" | + | |
- | - The ''" | + | |
- | - The ''" | + | |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 190: | Line 102: | ||
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
- | Warnings and errors that are currently generated by the procedural versions of the Date/Time functionality | + | Warnings and errors that are currently generated by the procedural versions of the Date/Time functionality |
- | ===== Proposed | + | ===== Voting ===== |
- | Either for, or against. | + | To accept this RFC, and get more appropriate exceptions: |
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | Vote started December 15th, and runs until December 31st, 24:00 UTC. | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
Line 201: | Line 120: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | After the project is implemented, | + | |
- | - the version(s) it was merged into | + | - Version: PHP 8.3 |
- | - a link to the git commit(s) | + | - Commit: https:// |
- | - a link to the PHP manual entry for the feature | + | |
- | - a link to the language specification section (if any) | + | |
===== Rejected Features ===== | ===== Rejected Features ===== | ||
Line 211: | Line 128: | ||
None yet. | None yet. | ||
- | ===== Proposed PHP Version(s) | + | ===== ChangeLog |
- | Next PHP 8.x.8.x.y". | + | 0.9.1 |
+ | * Clarified that changing/ | ||
+ | * Clarified that the "Invalid serialization data for * object" | ||
- | ===== RFC Impact ===== | ||
- | |||
- | No impact to any other extensions or opcode. | ||
- | |||
- | ===== Open Issues ===== | ||
- | |||
- | There are currently no open issues. | ||
- | |||
- | ===== Unaffected PHP Functionality ===== | ||
- | |||
- | Warnings and errors that are currently generated by the procedural versions of the Date/Time functionality is not impacted. Only the Object Orientated interface is. | ||
- | |||
- | ===== Proposed Voting Choices ===== | ||
- | |||
- | Either for, or against. | ||
- | |||
- | ===== Patches and Tests ===== | ||
- | |||
- | There is no patch yet. | ||
- | |||
- | ===== Implementation ===== | ||
- | After the project is implemented, | ||
- | - the version(s) it was merged into | ||
- | - a link to the git commit(s) | ||
- | - a link to the PHP manual entry for the feature | ||
- | - a link to the language specification section (if any) | ||
- | |||
- | ===== Rejected Features ===== | ||
- | |||
- | None yet. |
rfc/datetime-exceptions.1669743328.txt.gz · Last modified: 2022/11/29 17:35 by derick