====== PHP RFC: Change Default PDO Error Mode ====== * Version: 1.0 * Date: 2020-03-28 * Author: AllenJB, php.lists@allenjb.me.uk * Status: Implemented * First Published at: http://wiki.php.net/rfc/pdo_default_errmode ===== Introduction ===== The current default error mode for PDO is silent. This means that when an SQL error occurs, no errors or warnings may be emitted and no exceptions thrown unless the developer implements their own explicit error handling. This causes issues for new developers because the only errors they often see from PDO code are knock-on errors such as "call to fetch() on non-object" - there's no indication that the SQL query (or other action) failed or why. ===== Proposal ===== This RFC proposes that the default PDO error mode by changed to PDO::ERRMODE_EXCEPTION in the next major PHP version. The silent error mode will still be available for developers to explicitly switch to. ===== Backward Incompatible Changes ===== Existing code that does not explicitly set the PDO error mode and relies on the silent mode will be affected by this change. This code can be updated by explicitly setting the PDO error mode to silent. ===== Proposed PHP Version(s) ===== Next PHP x (PHP 8.0) ===== RFC Impact ===== ==== To SAPIs ==== No changes to SAPIs. ==== To Existing Extensions ==== Existing extensions should not be affected (it is assumed any PDO extensions can already cope with error mode being set to exceptions). ==== To Opcache ==== No changes. ==== New Constants ==== This RFC introduces no new constants. ===== Open Issues ===== None. ===== Proposed Voting Choices ===== Voting starts 2020-04-13 and ends 2020-04-27 This vote requires a 2/3 majority. * Yes * No ===== Patches and Tests ===== PR: https://github.com/php/php-src/pull/5388 ===== Implementation ===== (Pending implementation) ===== References ===== * Initial internals discussion: https://externals.io/message/109015 * RFC discussion thread: https://externals.io/message/109398 ===== Rejected Features ===== None.