cvs: pecl /sqlite sqlite.c /sqlite/tests sqlite_018.phpt

From: Date: Mon, 23 Jun 2003 19:37:48 +0000
Subject: cvs: pecl /sqlite sqlite.c /sqlite/tests sqlite_018.phpt
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-296@lists.php.net to get a copy of this message
iliaa Mon Jun 23 15:37:48 2003 EDT Modified files: /pecl/sqlite sqlite.c /pecl/sqlite/tests sqlite_018.phpt Log: port sqlite_array_query() fix from PHP_4_3 Index: pecl/sqlite/sqlite.c diff -u pecl/sqlite/sqlite.c:1.57 pecl/sqlite/sqlite.c:1.58 --- pecl/sqlite/sqlite.c:1.57 Sun Jun 22 15:00:44 2003 +++ pecl/sqlite/sqlite.c Mon Jun 23 15:37:47 2003 @@ -17,7 +17,7 @@ | Marcus Boerger <helly@php.net> | +----------------------------------------------------------------------+ - $Id: sqlite.c,v 1.57 2003/06/22 19:00:44 helly Exp $ + $Id: sqlite.c,v 1.58 2003/06/23 19:37:47 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -933,7 +933,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.57 2003/06/22 19:00:44 helly Exp $"); + php_info_print_table_row(2, "PECL Module version", PHP_SQLITE_MODULE_VERSION " $Id: sqlite.c,v 1.58 2003/06/23 19:37:47 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(); @@ -1305,8 +1305,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) { @@ -1320,7 +1323,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; @@ -1664,6 +1671,10 @@ rres = (struct php_sqlite_result *)emalloc(sizeof(*rres)); sqlite_query(NULL, 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 diff -u /dev/null pecl/sqlite/tests/sqlite_018.phpt:1.2 --- /dev/null Mon Jun 23 15:37:48 2003 +++ pecl/sqlite/tests/sqlite_018.phpt Mon Jun 23 15:37:48 2003 @@ -0,0 +1,13 @@ +--TEST-- +sqlite: crash on bad queries inside sqlite_array_query() +--SKIPIF-- +<?php # vim:ft=php +if (!extension_loaded("sqlite")) print "skip"; ?> +--FILE-- +<?php +include "blankdb.inc"; + +sqlite_array_query($db, "SELECT foo FROM foobar"); +?> +--EXPECTF-- +Warning: sqlite_array_query(): no such table: foobar in %s on line %d

« previous php.pecl.cvs (#296) next »