summaryrefslogtreecommitdiff
path: root/ext/sqlite/sqlite.c
diff options
context:
space:
mode:
authorJohannes Schlüter <johannes@php.net>2009-06-25 09:38:04 +0000
committerJohannes Schlüter <johannes@php.net>2009-06-25 09:38:04 +0000
commit84940122a9e7898c239e97af8db13912b8e5ae91 (patch)
tree61b735bdd21a54598c26bc143ca8cbe63058c417 /ext/sqlite/sqlite.c
parente01ff47c4372c249b9f195d5eda09bd76542c4d9 (diff)
downloadphp-git-84940122a9e7898c239e97af8db13912b8e5ae91.tar.gz
MFH Fix bug #48679 - Crash in SQLite with count on an unbuffered query set (Scott)
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r--ext/sqlite/sqlite.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index f1f8f60a27..f9b47c9a74 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -2819,6 +2819,11 @@ static int sqlite_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
{
sqlite_object *obj = (sqlite_object*) zend_object_store_get_object(object TSRMLS_CC);
+ if (obj->u.res == NULL) {
+ zend_throw_exception(sqlite_ce_exception, "Row count is not available for this query", 0 TSRMLS_CC);
+ return FAILURE;
+ }
+
if (obj->u.res->buffered) {
* count = obj->u.res->nrows;
return SUCCESS;