CodeIgniter4 icon indicating copy to clipboard operation
CodeIgniter4 copied to clipboard

Bug: insertBatch throws a non catchable mysqli_sql_exception

Open mentorduncan opened this issue 1 year ago • 0 comments

PHP Version

8.3

CodeIgniter4 Version

4.5.5

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MariaDB 11.4.2

What happened?

ERROR - 2024-10-02 16:17:07 --> mysqli_sql_exception: Duplicate entry '620-43' for key 'fk_UNIQUE'

Steps to Reproduce

Create a pivot table, where the combination of the two fk columns is unique.

Feed it with some combinations of fks And do an insertBatch where there is a collision.

Despite logging the error above, the script will run until the end. And it was not possible to capture the error even with: catch (DatabaseException $e) catch (\mysqli_sql_exception $e) or catch (\Exception $e)

Expected Output

a more user-friendly or catchable error for me to deal with.

Anything else?

No response

mentorduncan avatar Oct 02 '24 19:10 mentorduncan