dibi icon indicating copy to clipboard operation
dibi copied to clipboard

SQLite3::enableExceptions(false) is deprecated in PHP 8.3 and later

Open ferenclakos opened this issue 1 year ago • 1 comments

Version: 5.0.1 PHP: 8.3.1

Bug Description

I get a warning message when I use SQLite driver.

Deprecated:  SQLite3::enableExceptions(): Use of warnings for SQLite3 is deprecated in
.../vendor/dibi/dibi/src/Dibi/Drivers/SqliteDriver.php on line 60

Steps To Reproduce

$connection = new Connection([
  'driver' => 'sqlite',
  'database' => 'example.s3db',
]);

More Information

  • https://php.watch/versions/8.3/SQLite3-exception-improvements#enableExceptions-deprecated

ferenclakos avatar Dec 28 '23 11:12 ferenclakos

If I understand correctly, SQLite only throws exceptions since PHP 8.3. This means that we need to modify Dibi\Drivers\SqliteDriver. First, in __construct it must activate exceptions for older PHP versions. And then catch and handle them in query(). I will be glad for PR.

dg avatar Dec 30 '23 21:12 dg