nette/database

Warning: A non-numeric value encountered in /path/to/vendor/nette/database/src/Database/ResultSet.php on line 163

Opened this issue · 1 comments

  • bug report? yes
  • feature request? no
  • version: "nette/database": "v2.4.2"

Description

I am using sqlite and am querying a table with COLUMN yielded INTEGER DEFAULT 0. It seems that sometimes, the value of yielded returns empty and then I see the following error:

Warning: A non-numeric value encountered in /path/to/vendor/nette/database/src/Database/ResultSet.php on line 163

The $value variable in line 163 is always a string but only when the string is empty then the warning appears. Maybe it can be solved by making sure that $value === '' is handled differently (e.g added to line 159: if ($value === NULL || $value === FALSE || $type === IStructure::FIELD_TEXT) {)

Steps To Reproduce

Create an sqlite database and then execute:

CREATE TABLE IF NOT EXISTS test (
 COLUMN yielded INTEGER DEFAULT 0
);

Then just query the table by using

$db->query('SELECT * FROM test;');
s0kil commented

I am having the same issue.