summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-11-17 14:38:36 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-11-17 14:38:36 +0000
commitd7346692304ef365014362321360fa828ab28cbc (patch)
tree2824ca4e4be6c7f626de8353ac61400b97cae69c
parent1a78dc5fbf54732e9edb27a79dc1116d971adf7f (diff)
downloadphp-git-d7346692304ef365014362321360fa828ab28cbc.tar.gz
Fixed bug #35248 (sqlite_query() doesnt set error_msg when return value is
being used).
-rw-r--r--NEWS14
-rw-r--r--ext/sqlite/sqlite.c13
-rw-r--r--ext/sqlite/tests/bug35248.phpt15
3 files changed, 35 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index 19e30e6641..44b9b5e676 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,18 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+17 Nov 2005, PHP 5.1 Release Candidate 6
+- Make zend_parse_params handle integers in a non-strict fashion, but emit an
+ E_NOTICE on non well formed interger values. (Ilia)
+- Fixed bug #35249 (compile failure when ext/readline is compiled as shared).
+ (Jani)
+- Fixed bug #35248 (sqlite_query() doesnt set error_msg when return value is
+ being used). (Ilia)
+- Fixed bug #35079 (stream_set_blocking(true) toggles, not enables
+ blocking). (askalski at gmail dot com, Tony)
+
16 Nov 2005, PHP 5.1 Release Candidate 5
+- Added an E_STRICT warning on the usage of {} for accessing of string offsets.
+ (Ilia)
- Changed type hints to allow "null" as default value for class and array.
(Marcus, Derick, Dmitry)
- Fixed __get/__set to allow recursive calls for different properties. (Dmitry)
@@ -19,8 +31,6 @@ PHP NEWS
- Fixed bug #35142 (SOAP Client/Server Complex Object Support). (Dmitry)
- Fixed bug #35135 (PDOStatment without related PDO object may crash). (Ilia)
- Fixed bug #35091 (SoapClient leaks memory). (Dmitry)
-- Fixed bug #35079 (stream_set_blocking(true) toggles, not enables
- blocking). (askalski at gmail dot com, Tony)
- Fixed bug #35078 (configure does not find ldap_start_tls_s). (Jani)
- Fixed bugs #35022, #35019 (Regression in the behavior of key() and current()
functions). (Ilia)
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 243ade6573..e1c1219855 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -1516,7 +1516,7 @@ next_row:
/* }}} */
/* {{{ sqlite_query */
-void sqlite_query(zval *object, struct php_sqlite_db *db, char *sql, long sql_len, int mode, int buffered, zval *return_value, struct php_sqlite_result **prres TSRMLS_DC)
+void sqlite_query(zval *object, struct php_sqlite_db *db, char *sql, long sql_len, int mode, int buffered, zval *return_value, struct php_sqlite_result **prres, zval *errmsg TSRMLS_DC)
{
struct php_sqlite_result res, *rres;
int ret;
@@ -1532,6 +1532,9 @@ void sqlite_query(zval *object, struct php_sqlite_db *db, char *sql, long sql_le
if (ret != SQLITE_OK) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", errtext);
+ if (errmsg) {
+ ZVAL_STRING(errmsg, errtext, 1);
+ }
sqlite_freemem(errtext);
goto terminate;
} else if (!res.vm) { /* empty query */
@@ -1632,7 +1635,7 @@ PHP_FUNCTION(sqlite_unbuffered_query)
return;
}
- sqlite_query(object, db, sql, sql_len, (int)mode, 0, return_value, NULL TSRMLS_CC);
+ sqlite_query(object, db, sql, sql_len, (int)mode, 0, return_value, NULL, errmsg TSRMLS_CC);
}
/* }}} */
@@ -1757,7 +1760,7 @@ PHP_FUNCTION(sqlite_query)
return;
}
- sqlite_query(object, db, sql, sql_len, (int)mode, 1, return_value, NULL TSRMLS_CC);
+ sqlite_query(object, db, sql, sql_len, (int)mode, 1, return_value, NULL, errmsg TSRMLS_CC);
}
/* }}} */
@@ -2168,7 +2171,7 @@ PHP_FUNCTION(sqlite_array_query)
}
rres = (struct php_sqlite_result *)emalloc(sizeof(*rres));
- sqlite_query(NULL, db, sql, sql_len, (int)mode, 0, NULL, &rres TSRMLS_CC);
+ sqlite_query(NULL, db, sql, sql_len, (int)mode, 0, NULL, &rres, NULL TSRMLS_CC);
if (db->last_err_code != SQLITE_OK) {
if (rres) {
efree(rres);
@@ -2284,7 +2287,7 @@ PHP_FUNCTION(sqlite_single_query)
}
rres = (struct php_sqlite_result *)emalloc(sizeof(*rres));
- sqlite_query(NULL, db, sql, sql_len, PHPSQLITE_NUM, 0, NULL, &rres TSRMLS_CC);
+ sqlite_query(NULL, db, sql, sql_len, PHPSQLITE_NUM, 0, NULL, &rres, NULL TSRMLS_CC);
if (db->last_err_code != SQLITE_OK) {
if (rres) {
efree(rres);
diff --git a/ext/sqlite/tests/bug35248.phpt b/ext/sqlite/tests/bug35248.phpt
new file mode 100644
index 0000000000..4898a4142e
--- /dev/null
+++ b/ext/sqlite/tests/bug35248.phpt
@@ -0,0 +1,15 @@
+--TEST--
+Bug #35248 (sqlite_query does not return parse error message)
+--SKIPIF--
+<?php if (!extension_loaded("sqlite")) print "skip"; ?>
+--FILE--
+<?php
+ $db = sqlite_open(":memory:");
+ $res = @sqlite_query($db, "asdfesdfa", SQLITE_NUM, $err);
+ var_dump($err);
+ $res = @sqlite_unbuffered_query($db, "asdfesdfa", SQLITE_NUM, $err);
+ var_dump($err);
+?>
+--EXPECT--
+string(30) "near "asdfesdfa": syntax error"
+string(30) "near "asdfesdfa": syntax error"