#45798 [NEW]: sqlite3 doesn't notice if variable was bound

[email protected] ("[email protected]")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             [email protected]
Operating system: OSX
PHP version:      5.3.0alpha1
PHP Bug Type:     SQLite related
Bug description:  sqlite3 doesn't notice if variable was bound

Description:
------------
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:
---------------
<?php
$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))
{
	var_dump($result);
}
$results->finalize();

$db->close();
?>



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

Actual result:
--------------
PHP freeze, doing nothing.

-- 
Edit bug report at http://bugs.php.net/?id=45798&edit=1
-- 
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45798&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45798&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45798&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45798&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=45798&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45798&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45798&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45798&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45798&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45798&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=45798&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=45798&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45798&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45798&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45798&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45798&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45798&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45798&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45798&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45798&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.