com php-src: Fixed bug #72668 (Spurious warning when exception is thrown in user defined function): NEWS ext/sqlite3/sqlite3.c
ext/sqlite3/tests/bug72668.phpt

From: Date: Mon, 25 Jul 2016 12:28:39 +0000
Subject: com php-src: Fixed bug #72668 (Spurious warning when exception is thrown in user defined function): NEWS ext/sqlite3/sqlite3.c
ext/sqlite3/tests/bug72668.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-93388@lists.php.net to get a copy of this message
Commit: f5e56cf9707a1be547cc29f568d6f60dbdbb1e4c Author: Xinchen Hui <laruence@gmail.com> Mon, 25 Jul 2016 20:28:39 +0800 Parents: 9a4c9348b1d5d533df6c876a62256a77704f29b7 Branches: PHP-7.0 PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f5e56cf9707a1be547cc29f568d6f60dbdbb1e4c Log: Fixed bug #72668 (Spurious warning when exception is thrown in user defined function) Bugs: https://bugs.php.net/72668 Changed paths: M NEWS M ext/sqlite3/sqlite3.c A ext/sqlite3/tests/bug72668.phpt Diff: diff --git a/NEWS b/NEWS index 31d8ee7..6d1b69e 100644 --- a/NEWS +++ b/NEWS @@ -75,6 +75,8 @@ PHP NEWS character). (cmb) - SQLite3: + . Fixed bug #72668 (Spurious warning when exception is thrown in user defined + function). (Laruence) . Fixed bug #72571 (SQLite3::bindValue, SQLite3::bindParam crash). (Laruence) - Standard: diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 0e0ef09..c9b6686 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -672,8 +672,10 @@ PHP_METHOD(sqlite3, querySingle) break; } default: + if (!EG(exception)) { php_sqlite3_error(db_obj, "Unable to execute statement: %s", sqlite3_errmsg(db_obj->db)); - RETVAL_FALSE; + } + RETVAL_FALSE; } sqlite3_finalize(stmt); } diff --git a/ext/sqlite3/tests/bug72668.phpt b/ext/sqlite3/tests/bug72668.phpt new file mode 100644 index 0000000..ccb238f --- /dev/null +++ b/ext/sqlite3/tests/bug72668.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #72668 (Spurious warning when exception is thrown in user defined function) +--SKIPIF-- +<?php +if (!extension_loaded('sqlite3')) die('skip'); ?> +--FILE-- +<?php +function my_udf_md5($string) { + 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); +} +catch(\Exception $e) { + echo "Exception: ".$e->getMessage(); +} +?> +--EXPECT-- +Exception: test exception

« previous php.cvs (#93388) next »