|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45798 sqlite3 doesn't notice if variable was bound
Submitted: 2008-08-12 13:11 UTC Modified: 2008-08-15 14:08 UTC
From: Assigned: scottmac (profile)
Status: Closed Package: SQLite related
PHP Version: 5.3.0alpha1 OS: OSX
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2008-08-12 13:11 UTC]
If a prepared statement is executed while the bound variable doesn't 
exist, or is NULL, PHP freeze and wait. 

I tweaked the test also to use SQLITE3_NULL instead of SQLITE3_TEXT, and 
NULL or !isset($foo) also froze PHP. 

Reproduce code:
$db = new SQLite3(':memory:');

// cr?ation d'une table
$db->exec('CREATE TABLE test (time INTEGER, id STRING)');

$db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
$db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");

$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");

//$foo = 'a'; works OK 
//$foo = NULL; also freeze
$stmt->bindParam(1, $foo, SQLITE3_TEXT);
$results = $stmt->execute();
while ($result = $results->fetchArray(SQLITE3_NUM))


Expected result:
I would expect PHP to return from execute with an error. 

Actual result:
PHP freeze, doing nothing.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-12 13:31 UTC]
Assign to maintainer
 [2008-08-12 13:36 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

I'm not the maintainer, but as it's a simple fix, I commited it, ok Scott? :)
 [2008-08-15 14:08 UTC]
Sure, I don't mind anyone fixing things.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 23:01:28 2024 UTC