|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56297 Columns returning as NULL, even thou contain not NULL data.
Submitted: 2005-02-12 21:44 UTC Modified: 2005-02-27 20:32 UTC
From: Jared dot Williams1 at ntlworld dot com Assigned: wez (profile)
Status: Closed Package: PDO_SQLITE (PECL)
PHP Version: 5_0 CVS-2005-02-12 (dev) OS: Windows 2000/IIS
Private report: No CVE-ID: None
 [2005-02-12 21:44 UTC] Jared dot Williams1 at ntlworld dot com
I _think_ (and hope) I've encounted an sqlite bug with 3.0.7, which does not seem present in the "official" sqlite3 (3.0.8) cmdline tool.

I cannot find the releveant sqlite ticket to prove this, but I think its highly unlikely PDO itself is causing it.

Several columns are always coming back with containing NULL, even thou there is some data in some rows, but modifing the SQL so one of these columns in used in the WHERE clause.


Reproduce code:
	$pdo = new PDO('sqlite:Xtvd.sql3', '', '');
	// Returns 94 rows all with p.starRating = NULL
	$stmt = $pdo->query("SELECT DISTINCT p.*
						FROM Program AS p INNER JOIN Schedule AS s ON s.program =
						WHERE s.time BETWEEN '2005-02-13T01:30:00Z' AND '2005-02-13T13:30:00Z';");

	echo '<hr />';
	// Returns 13 rows...
	$stmt = $pdo->query("SELECT DISTINCT p.*
						FROM Program AS p INNER JOIN Schedule AS s ON s.program =
						WHERE s.time BETWEEN '2005-02-13T01:30:00Z' AND '2005-02-13T13:30:00Z'
								AND p.starRating IS NOT NULL


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-12 22:48 UTC]
Can you try manually building pdo_sqlite and linking against the sqlite 3.0.8 libraries?

Something like this:

tar xzf PDO_SQLITE-*.tgz
./configure --with-pdo-sqlite=/sqlite/prefix
make install
 [2005-02-13 09:56 UTC] Jared dot Williams1 at ntlworld dot com
Recompiled pdo_sqlite with 3.0.8 (& vs.net2003) and problem still exists.

Also tried "official" sqlite3 3.0.7 tool and problem doesnt appear.

Reclassified as PDO_SQLITE Bug.

Test case:

Containing an sqlite3 database, and a php page, demonstrating the problem.
 [2005-02-19 07:44 UTC] Jared dot Williams1 at ntlworld dot com
Ooops, for got change bug type.
 [2005-02-27 00:25 UTC]
I've spent a lot of time sniffing around this tonight, and I believe it to be a bug in the sqlite library when using sqlite3_prepare() and sqlite3_step().  The library is telling PDO that the column type is NULL; even if I disregard that and ask for the data, the library returns me a NULL.

I'm opening a ticket on the sqlite site now.
 [2005-02-27 00:44 UTC]
SQLite ticket is:
 [2005-02-27 20:32 UTC]
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on

In case this was a website problem, the change will show
up on the website in short time.
Thank you for the report, and for helping us make PECL better.

The problem was that the sqlite driver was telling PDO that the column was always NULL in situations where the first row of the query came back with a NULL value.
I've corrected this issue in CVS, and it should be available to you in the next windows snap build.
I'm going to double-check that the windows build actually builds now, because I also upgraded the bundled sqlite to 3.1.3.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Oct 16 09:03:33 2021 UTC