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

From: Date: Fri, 15 Aug 2008 14:08:27 +0000
Subject: #45798 [Csd]: sqlite3 doesn't notice if variable was bound
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-128104@lists.php.net to get a copy of this message
 ID:               45798
 Updated by:       scottmac@php.net
 Reported By:      dams@php.net
 Status:           Closed
 Bug Type:         SQLite related
 Operating System: OSX
 PHP Version:      5.3.0alpha1
 Assigned To:      scottmac
 New Comment:

Sure, I don't mind anyone fixing things.


Previous Comments:
------------------------------------------------------------------------

[2008-08-12 13:36:22] felipe@php.net

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
http://snaps.php.net/.
 
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-12 13:31:33] johannes@php.net

Assign to maintainer

------------------------------------------------------------------------

[2008-08-12 13:11:17] dams@php.net

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 this bug report at http://bugs.php.net/?id=45798&edit=1



Thread (4 messages)

« previous php.bugs (#128104) next »