database icon indicating copy to clipboard operation
database copied to clipboard

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

Open Shaked opened this issue 7 years ago • 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;');

Shaked avatar Mar 02 '17 17:03 Shaked

I am having the same issue.

s0kil avatar Jul 15 '18 14:07 s0kil