You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kenjis
changed the title
Dev: DatabaseException may not be thrown if query fails
Dev: DatabaseException may not be thrown even if query fails
Nov 27, 2022
kenjis
changed the title
Dev: DatabaseException may not be thrown even if query fails
Dev: DatabaseException might not be thrown even if query fails
Jan 27, 2024
--- a/app/Config/Boot/testing.php+++ b/app/Config/Boot/testing.php@@ -14,7 +14,7 @@
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
-error_reporting(E_ALL);+error_reporting(E_ALL & ~E_WARNING);
ini_set('display_errors', '1');
/*
$ vendor/bin/phpunit tests/system/Database/Live/TransactionTest.php PHPUnit 9.6.16 by Sebastian Bergmann and contributors.Runtime: PHP 8.2.15Configuration: /Users/kenji/work/codeigniter/official/CodeIgniter4-4.5/phpunit.xmlF... 4 / 4 (100%)Time: 00:00.231, Memory: 18.00 MBThere was 1 failure:1) CodeIgniter\Database\Live\TransactionTest::testTransStartDBDebugTrueFailed asserting that null is an instance of class "CodeIgniter\Database\Exceptions\DatabaseException"./Users/kenji/work/codeigniter/official/CodeIgniter4-4.5/tests/system/Database/Live/TransactionTest.php:106FAILURES!Tests: 4, Assertions: 14, Failures: 1.
SQLSRV driver has different implementation. It throws Exception when the query return value is false.
This is correct.
SQLite3, Postgres and OCI8 drivers should throw Exception when the query return value is false.
SQLite3, Postgres and OCI8 drivers throw ErrorException when a query error occurs
because of Error Handler. See #6912
CodeIgniter4/system/Debug/Exceptions.php
Lines 174 to 176 in ac1422c
So depending on the value of the error reporting setting, the ErrorException may not be thrown.
See #6886 (comment)
The text was updated successfully, but these errors were encountered: