cvs: pecl(PHP_4_3) /sqlite sqlite.c /sqlite/tests sqlite_018.phpt
| From: | Ilia Alshanetsky | Date: | Mon, 23 Jun 2003 19:30:42 +0000 |
| Subject: | cvs: pecl(PHP_4_3) /sqlite sqlite.c /sqlite/tests sqlite_018.phpt | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-295@lists.php.net to get a copy of this message | ||
iliaa Mon Jun 23 15:30:42 2003 EDT
Added files: (Branch: PHP_4_3)
/pecl/sqlite/tests sqlite_018.phpt
Modified files:
/pecl/sqlite sqlite.c
Log:
Fixed a crash inside sqlite_array_query() when invalid query
is specified.
Index: pecl/sqlite/sqlite.c
diff -u pecl/sqlite/sqlite.c:1.55 pecl/sqlite/sqlite.c:1.55.2.1
--- pecl/sqlite/sqlite.c:1.55 Sat Jun 21 09:29:26 2003
+++ pecl/sqlite/sqlite.c Mon Jun 23 15:30:42 2003
@@ -17,7 +17,7 @@
| Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
- $Id: sqlite.c,v 1.55 2003/06/21 13:29:26 wez Exp $
+ $Id: sqlite.c,v 1.55.2.1 2003/06/23 19:30:42 iliaa Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -666,7 +666,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.55 2003/06/21 13:29:26 wez Exp $");
+ php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id:
sqlite.c,v 1.55.2.1 2003/06/23 19:30:42 iliaa 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();
@@ -972,8 +972,11 @@
if (ret != SQLITE_OK) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
sqlite_freemem(errtext);
-
- RETURN_FALSE;
+ if (return_value) {
+ RETURN_FALSE;
+ } else {
+ return;
+ }
}
if (!rres) {
@@ -987,7 +990,11 @@
/* now the result set is ready for stepping: get first row */
if (php_sqlite_fetch(rres TSRMLS_CC) != SQLITE_OK) {
real_result_dtor(rres TSRMLS_CC);
- RETURN_FALSE;
+ if (return_value) {
+ RETURN_FALSE;
+ } else {
+ return;
+ }
}
rres->curr_row = 0;
@@ -1276,6 +1283,10 @@
rres = (struct php_sqlite_result *)emalloc(sizeof(*rres));
sqlite_query(db, sql, sql_len, mode, 0, NULL, rres TSRMLS_CC);
+ if (db->last_err_code != SQLITE_OK) {
+ efree(rres);
+ RETURN_FALSE;
+ }
array_init(return_value);
Index: pecl/sqlite/tests/sqlite_018.phpt
+++ pecl/sqlite/tests/sqlite_018.phpt