scottmac Thu Jun 25 00:07:21 2009 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/sqlite/tests bug48679.phpt
Modified files:
/php-src/ext/sqlite sqlite.c
Log:
MFH 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.166.2.13.2.12&r2=1.166.2.13.2.13&diff_format=u
Index: php-src/ext/sqlite/sqlite.c
diff -u php-src/ext/sqlite/sqlite.c:1.166.2.13.2.12
php-src/ext/sqlite/sqlite.c:1.166.2.13.2.13
--- php-src/ext/sqlite/sqlite.c:1.166.2.13.2.12 Wed Dec 31 11:17:44 2008
+++ php-src/ext/sqlite/sqlite.c Thu Jun 25 00:07:20 2009
@@ -17,7 +17,7 @@
| Marcus Boerger <[email protected]> |
+----------------------------------------------------------------------+
- $Id: sqlite.c,v 1.166.2.13.2.12 2008/12/31 11:17:44 sebastian Exp $
+ $Id: sqlite.c,v 1.166.2.13.2.13 2009/06/25 00:07:20 scottmac Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -1128,7 +1128,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.166.2.13.2.12 2008/12/31 11:17:44
sebastian Exp $");
+ php_info_print_table_row(2, "PECL Module version",
PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.166.2.13.2.13 2009/06/25 00:07:20
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();
@@ -2481,6 +2481,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