rfc:sqlite3_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:sqlite3_exceptions [2022/10/29 09:45] bohwazrfc:sqlite3_exceptions [2023/07/17 04:06] (current) – Add links for implementations girgias
Line 3: Line 3:
   * Date: 2022-10-24   * Date: 2022-10-24
   * Author: BohwaZ, php at bohwaz dot net   * Author: BohwaZ, php at bohwaz dot net
-  * Status: Under discussion+  * Status: Implemented 
 +  * Implementation: https://github.com/php/php-src/commit/ddd9a08f566d86083d04de320e24f0751a1de759
   * First Published at: http://wiki.php.net/rfc/sqlite3_exceptions   * First Published at: http://wiki.php.net/rfc/sqlite3_exceptions
  
Line 13: Line 14:
 It's time to move to exceptions. It's time to move to exceptions.
  
-===== Proposal =====+===== Proposal =====
  
 Progressively deprecate warnings (PHP 8.3), make exceptions the default (9.0) and remove warnings (10.0). Progressively deprecate warnings (PHP 8.3), make exceptions the default (9.0) and remove warnings (10.0).
Line 19: Line 20:
 In PHP 8.3: In PHP 8.3:
  
-  * Create a new exception class ''SQLite3Exception'', which extends the SPL ''RuntimeException'' class, like in mysqli and PDO+  * Create a new exception class ''SQLite3Exception'', which extends the ''Exception'' class
   * Remove SQLite3 error code from the error message, and assign it to the exception code   * Remove SQLite3 error code from the error message, and assign it to the exception code
   * Make ''SQLite3::enableExceptions(true)'' throw SQLite3Exception instead of Exception   * Make ''SQLite3::enableExceptions(true)'' throw SQLite3Exception instead of Exception
-  * Default behavior is still to raise warnings 
   * Calling ''SQLite3::enableExceptions(false)'' raises ''E_DEPRECATED''   * Calling ''SQLite3::enableExceptions(false)'' raises ''E_DEPRECATED''
 +  * Default behavior is still to raise warnings (''enableExceptions(false)'')
  
 In PHP 9.0: In PHP 9.0:
Line 35: Line 36:
  
   * Remove the ''SQLite3::enableExceptions'' method   * Remove the ''SQLite3::enableExceptions'' method
- 
-===== Proposal 2 ===== 
- 
-Same as proposal 1, but make ''SQLite3'' throw exceptions by default in PHP 8.3 instead of 9.0. 
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 44: Line 41:
 In PHP 8.3: In PHP 8.3:
  
-  * Code parsing the error message to get the error code may fail, but this is unlikely as the proper way is to use ''SQLite3::lastErrorCode()''+  * Code parsing the error message to get the error code may fail as the error code has been moved to be consistently at the end of the error message string. This is unlikely as the proper way is to use ''SQLite3::lastErrorCode()''.
   * Code already relying on exceptions will not see a difference, as previously \Exception was thrown, and \SQLite3Exception is a subclass of \Exception   * Code already relying on exceptions will not see a difference, as previously \Exception was thrown, and \SQLite3Exception is a subclass of \Exception
-  * (Proposal 2 only:) code not using ''enableExceptions'' to enable warnings will need to add this call and mute the E_DEPRECATED message 
  
 In PHP 9.0: In PHP 9.0:
Line 93: Line 89:
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
  
-  * 1: accept proposal 1 (deprecate progressively, default to exceptions in 9.0) +  * 1: accept proposal 
-  * 2: accept proposal 2 (same, but default to exceptions in 8.3) +  * 2: don't change anything
-  * 3: don't change anything+
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
  
-Pull request: https://github.com/php/php-src/pull/9816 (this is for the while behaviour for 10.0, it will be broken into multiple PRs)+Pull request
 + 
 +  * 8.3: https://github.com/php/php-src/pull/11058
  
 ===== Implementation ===== ===== Implementation =====
Line 111: Line 108:
 ===== References ===== ===== References =====
  
-* https://externals.io/message/118873+  * https://externals.io/message/118873 
 + 
 + 
 + 
 +===== Vote ===== 
 + 
 +Voting started 2023-05-09 and has ended end 2023-05-23, Europe/Paris timezone. 
 + 
 +<doodle title="Use exceptions by default in SQLite3 extension as described in this RFC?" auth="bohwaz" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
-===== Rejected Features ===== 
-Keep this updated with features that were discussed on the mail lists. 
rfc/sqlite3_exceptions.1667036736.txt.gz · Last modified: 2022/10/29 09:45 by bohwaz