summaryrefslogtreecommitdiff
path: root/ext/sqlite3
diff options
context:
space:
mode:
authorChristoph M. Becker <cmb@php.net>2016-07-25 17:15:10 +0200
committerChristoph M. Becker <cmb@php.net>2016-07-25 17:15:10 +0200
commitac0bbea3a89334b47995315cd37ca342e89486f2 (patch)
treee261ec88fcdf6a670f3b48bcb59eafa2d7ee11e6 /ext/sqlite3
parent2334d8335b902ec0e51f677f30bc8adcd41bf503 (diff)
parentccf39dd55243054535be02261485d56fbe5539d5 (diff)
downloadphp-git-ac0bbea3a89334b47995315cd37ca342e89486f2.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
Diffstat (limited to 'ext/sqlite3')
-rw-r--r--ext/sqlite3/sqlite3.c8
-rw-r--r--ext/sqlite3/tests/bug72668.phpt25
2 files changed, 27 insertions, 6 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 96b1dd2178..66a9e488b3 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -555,7 +555,9 @@ PHP_METHOD(sqlite3, query)
break;
}
default:
- php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db));
+ if (!EG(exception)) {
+ php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db));
+ }
sqlite3_finalize(stmt_obj->stmt);
stmt_obj->initialised = 0;
zval_dtor(return_value);
@@ -1611,7 +1613,9 @@ PHP_METHOD(sqlite3stmt, execute)
sqlite3_reset(stmt_obj->stmt);
default:
- php_sqlite3_error(stmt_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db_handle(stmt_obj->stmt)));
+ if (!EG(exception)) {
+ php_sqlite3_error(stmt_obj->db_obj, "Unable to execute statement: %s", sqlite3_errmsg(sqlite3_db_handle(stmt_obj->stmt)));
+ }
zval_dtor(return_value);
RETURN_FALSE;
}
diff --git a/ext/sqlite3/tests/bug72668.phpt b/ext/sqlite3/tests/bug72668.phpt
index ccb238f8e4..2845fa0a7c 100644
--- a/ext/sqlite3/tests/bug72668.phpt
+++ b/ext/sqlite3/tests/bug72668.phpt
@@ -6,19 +6,36 @@ if (!extension_loaded('sqlite3')) die('skip'); ?>
--FILE--
<?php
function my_udf_md5($string) {
- throw new \Exception("test exception\n");
+ throw new \Exception("test exception\n");
}
$db = new SQLite3(':memory:');
$db->createFunction('my_udf_md5', 'my_udf_md5');
try {
- $result = $db->querySingle('SELECT my_udf_md5("test")');
- var_dump($result);
+ $result = $db->query('SELECT my_udf_md5("test")');
+ var_dump($result);
}
catch(\Exception $e) {
- echo "Exception: ".$e->getMessage();
+ echo "Exception: ".$e->getMessage();
+}
+try {
+ $result = $db->querySingle('SELECT my_udf_md5("test")');
+ var_dump($result);
+}
+catch(\Exception $e) {
+ echo "Exception: ".$e->getMessage();
+}
+$statement = $db->prepare('SELECT my_udf_md5("test")');
+try {
+ $result = $statement->execute();
+ var_dump($result);
+}
+catch(\Exception $e) {
+ echo "Exception: ".$e->getMessage();
}
?>
--EXPECT--
Exception: test exception
+Exception: test exception
+Exception: test exception