rfc:datetime-exceptions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:datetime-exceptions [2022/12/08 11:11] – Removed a BC line, as Tim says "the BC section "warning for broken serialisation data becomes a new Error" – this is not a new Error, this is unchanged. In fact ext/date was my example of choice for my RFC: 3v4l.org/7HsR9" derickrfc: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 <derick@php.net>   * Author: Derick Rethans <derick@php.net>
-  * Status: Under Discussion+  * Status: Implemented (2023-02-08)
   * First Published at: http://wiki.php.net/rfc/datetime-exceptions   * First Published at: http://wiki.php.net/rfc/datetime-exceptions
  
Line 13: Line 13:
 Right now, they are either warnings/errors, or plain "Exception" or "Error". This does not allow for catching Date/Time exceptions as they are not specific enough. Right now, they are either warnings/errors, or plain "Exception" or "Error". This does not allow for catching Date/Time exceptions as they are not specific enough.
  
 +Out of scope of this RFC is changing and improving warning, Error, and Exception messages.
  
 ===== Proposal ===== ===== Proposal =====
  
-The proposals is to reclassify warnings and errors as Exceptions, and introduce Date extension specific exceptions and errors.+The proposal 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: The rationale behind all of these is the following:
Line 35: Line 36:
   * Error   * Error
     * ''"Cannot modify readonly property DatePeriod::$%s"''     * ''"Cannot modify readonly property DatePeriod::$%s"''
-    * ''"Invalid serialization data for DateTime object"'' +    * ''"Invalid serialization data for DateTime object"'' (used with ''__set_state'' and ''__wakeup'') 
-    * ''"Invalid serialization data for DateTimeImmutable object"'' +    * ''"Invalid serialization data for DateTimeImmutable object"'' (used with ''__set_state'' and ''__wakeup'') 
-    * ''"Invalid serialization data for DateTimeZone object"'' +    * ''"Invalid serialization data for DateTimeZone object"'' (used with ''__set_state'' and ''__wakeup'') 
-    * ''"Invalid serialization data for DatePeriod object"''+    * ''"Invalid serialization data for DatePeriod object"'' (used with ''__set_state'' and ''__wakeup'')
     * ''"Unknown or bad format (%s) at position %d (%c) while unserializing: %s"'' (currently a warning)     * ''"Unknown or bad format (%s) at position %d (%c) while unserializing: %s"'' (currently a warning)
     * ''"Trying to compare uninitialized DateTimeZone objects"''     * ''"Trying to compare uninitialized DateTimeZone objects"''
Line 79: Line 80:
         * ''"%s(): Recurrence count must be greater than 0"''         * ''"%s(): Recurrence count must be greater than 0"''
  
-Procedural style use of date/time functions are not effected, and will continue to use warnings and errors as they currently do.+Procedural style use of date/time functions is not affected, and will continue to use warnings and errors as it currently does.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 101: Line 102:
 ===== Unaffected PHP Functionality ===== ===== 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.+Warnings and errors that are currently generated by the procedural versions of the Date/Time functionality are not impacted. Only the Object Orientated interface is.
  
-===== Proposed Voting Choices =====+===== Voting =====
  
-Either foror against.+To accept this RFCand get more appropriate exceptions: 
 + 
 +<doodle title="More Appropriate Date/Time Exceptions" auth="derick" voteType="single" closed="false" closeon="2023-01-01T00:00:00Z"> 
 +   * Yes 
 +   * No 
 +</doodle> 
 + 
 +Vote started December 15th, and runs until December 31st, 24:00 UTC.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
Line 112: Line 120:
  
 ===== Implementation ===== ===== Implementation =====
-After the project is implemented, this section should contain  + 
-  the version(s) it was merged into +Version: PHP 8.3 
-  a link to the git commit(s) +Commit: https://github.com/php/php-src/commit/66a1a911f1d6cd4b89c0bb5577fa77f1d6a2cb96
-  - a link to the PHP manual entry for the feature +
-  - a link to the language specification section (if any)+
  
 ===== Rejected Features ===== ===== Rejected Features =====
  
 None yet. None yet.
 +
 +===== ChangeLog =====
 +
 +0.9.1
 +  * Clarified that changing/improving messages is out of scope
 +  * Clarified that the "Invalid serialization data for * object" are used for both PHP's unserialize, as well as ''__set_state''.
  
rfc/datetime-exceptions.1670497868.txt.gz · Last modified: 2022/12/08 11:11 by derick