- Affected version
- 2.1.4
Consider the (contrived) sequence;
The resulting exception is of the wrong type;
Using MariaDB 10.4.x, and reported to occur with 10.3.x
PHP:
$db = \XF::db();
$db->query(' CREATE TEMPORARY TABLE nullable_test (
col int not null
)');
$db->query('insert into nullable_test (col) values (null)');
The resulting exception is of the wrong type;
An exception occurred: [XF\Db\DuplicateKeyException] MySQL query error [1048]: Column 'col' cannot be null in src/XF/Db/AbstractStatement.php on line 217
#0 src/XF/Db/Mysqli/Statement.php(196): XF\Db\AbstractStatement->getException('MySQL query err...', 1048, '23000')
#1 src/XF/Db/Mysqli/Statement.php(77): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1048, '23000')
#2 src/XF/Db/AbstractAdapter.php(94): XF\Db\Mysqli\Statement->execute()
#3 test.php(17): XF\Db\AbstractAdapter->query('insert into nul...')
#4 {main}
Using MariaDB 10.4.x, and reported to occur with 10.3.x