diff options
author | Felipe Pena <felipe@php.net> | 2008-08-12 13:37:32 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2008-08-12 13:37:32 +0000 |
commit | 9f40f81543ba5985038b0abcd01dea8bd80450fb (patch) | |
tree | dde0402357967b92f6477c75cadd2bcbacbda68d /ext/sqlite3 | |
parent | eae2c5390d8fa2d07cae8961ceca8a592d5be55b (diff) | |
download | php-git-9f40f81543ba5985038b0abcd01dea8bd80450fb.tar.gz |
- MFH: Fixed bug #45798 (sqlite3 doesn't notice if variable was bound)
Diffstat (limited to 'ext/sqlite3')
-rw-r--r-- | ext/sqlite3/sqlite3.c | 1 | ||||
-rw-r--r-- | ext/sqlite3/tests/bug45798.phpt | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index cd6037fffd..9015356580 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1069,6 +1069,7 @@ PHP_METHOD(sqlite3stmt, execute) /* If the ZVAL is null then it should be bound as that */ if (Z_TYPE_P(param->parameter) == IS_NULL) { sqlite3_bind_null(stmt_obj->stmt, param->param_number); + zend_hash_move_forward(stmt_obj->bound_params); continue; } diff --git a/ext/sqlite3/tests/bug45798.phpt b/ext/sqlite3/tests/bug45798.phpt new file mode 100644 index 0000000000..1beacc4910 --- /dev/null +++ b/ext/sqlite3/tests/bug45798.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #45798 (sqlite3 doesn't notice if variable was bound) +--SKIPIF-- +<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> +--FILE-- +<?php + +require_once(dirname(__FILE__) . '/new_db.inc'); + +$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"); + +$stmt->bindParam(1, $foo, SQLITE3_TEXT); +$results = $stmt->execute(); + +while ($result = $results->fetchArray(SQLITE3_NUM)) { + var_dump($result); +} + +$results->finalize(); + +$db->close(); + +print "done"; + +?> +--EXPECT-- +done |