scottmac Thu Jun 25 00:04:07 2009 UTC Added files: /php-src/ext/sqlite/tests bug48679.phpt
Modified files: /php-src/ext/sqlite sqlite.c Log: Fix bug #48679 - Crash in SQLite with count on an unbuffered query set http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/sqlite.c?r1=1.227&r2=1.228&diff_format=u Index: php-src/ext/sqlite/sqlite.c diff -u php-src/ext/sqlite/sqlite.c:1.227 php-src/ext/sqlite/sqlite.c:1.228 --- php-src/ext/sqlite/sqlite.c:1.227 Mon May 25 14:32:15 2009 +++ php-src/ext/sqlite/sqlite.c Thu Jun 25 00:04:07 2009 @@ -17,7 +17,7 @@ | Marcus Boerger <he...@php.net> | +----------------------------------------------------------------------+ - $Id: sqlite.c,v 1.227 2009/05/25 14:32:15 felipe Exp $ + $Id: sqlite.c,v 1.228 2009/06/25 00:04:07 scottmac Exp $ */ #ifdef HAVE_CONFIG_H @@ -1550,7 +1550,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "SQLite support", "enabled"); - php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.227 2009/05/25 14:32:15 felipe Exp $"); + php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.228 2009/06/25 00:04:07 scottmac Exp $"); php_info_print_table_row(2, "SQLite Library", sqlite_libversion()); php_info_print_table_row(2, "SQLite Encoding", sqlite_libencoding()); php_info_print_table_end(); @@ -3021,6 +3021,11 @@ { 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; http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite/tests/bug48679.phpt?view=markup&rev=1.1 Index: php-src/ext/sqlite/tests/bug48679.phpt +++ php-src/ext/sqlite/tests/bug48679.phpt --TEST-- Bug #48679 (sqlite2 count on unbuffered query causes segfault) --SKIPIF-- <?php if (!extension_loaded("sqlite")) print "skip"; ?> --FILE-- <?php try { $x = new sqliteunbuffered; count($x); } catch (SQLiteException $e) { var_dump($e->getMessage()); } echo "Done\n"; ?> --EXPECT-- unicode(41) "Row count is not available for this query" Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php