diff options
author | Scott MacVicar <scottmac@php.net> | 2008-03-08 04:18:29 +0000 |
---|---|---|
committer | Scott MacVicar <scottmac@php.net> | 2008-03-08 04:18:29 +0000 |
commit | 32c03b5f3291bac2580a46789d1de60db818cb50 (patch) | |
tree | bcf2a3a9fa7fbb42cfee38d306314d1f422e6ad6 /ext/sqlite/sqlite.c | |
parent | 8bbef4f940c4df2b319196a8a3d2c6110ac0782b (diff) | |
download | php-git-32c03b5f3291bac2580a46789d1de60db818cb50.tar.gz |
MFB: Fixed bug #42203 (Clear SQLite result sets before closing database.)
Diffstat (limited to 'ext/sqlite/sqlite.c')
-rw-r--r-- | ext/sqlite/sqlite.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c index 24c866a9fe..983000c8c6 100644 --- a/ext/sqlite/sqlite.c +++ b/ext/sqlite/sqlite.c @@ -403,6 +403,17 @@ static void real_result_dtor(struct php_sqlite_result *res TSRMLS_DC) efree(res); } +static int _clean_unfinished_results(zend_rsrc_list_entry *le, void *db TSRMLS_DC) +{ + if (Z_TYPE_P(le) == le_sqlite_result) { + struct php_sqlite_result *res = (struct php_sqlite_result *)le->ptr; + if (res->db->rsrc_id == ((struct php_sqlite_db*)db)->rsrc_id) { + real_result_dtor(res TSRMLS_CC); + } + } + return 0; +} + static ZEND_RSRC_DTOR_FUNC(php_sqlite_result_dtor) { struct php_sqlite_result *res = (struct php_sqlite_result *)rsrc->ptr; @@ -1423,6 +1434,10 @@ PHP_FUNCTION(sqlite_close) DB_FROM_ZVAL(db, &zdb); } + zend_hash_apply_with_argument(&EG(regular_list), + (apply_func_arg_t) _clean_unfinished_results, + db TSRMLS_CC); + zend_list_delete(Z_RESVAL_P(zdb)); } /* }}} */ |