php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72668 Spurious warning when exception is thrown in user defined function
Submitted: 2016-07-25 12:10 UTC Modified: -
From: cmb@php.net Assigned:
Status: Closed Package: SQLite related
PHP Version: 7.1.0beta1 OS: *
Private report: No CVE-ID:
 [2016-07-25 12:10 UTC] cmb@php.net
Description:
------------
This has been originally reported by @danack in bug #55416, which
is related, but not a duplicate.

When an exception is thrown inside a user-defined SQL function, a
spurious warning is additionally shown when a query using this
function is executed, even though the exception is caught.

For reference: <https://3v4l.org/I4TpT>.

Test script:
---------------
<?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();
}

Expected result:
----------------
Exception: test exception

Actual result:
--------------
Warning: SQLite3::querySingle(): Unable to execute statement:  in %s on line 10
Exception: test exception

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-25 12:29 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f5e56cf9707a1be547cc29f568d6f60dbdbb1e4c
Log: Fixed bug #72668 (Spurious warning when exception is thrown in user defined function)
 [2016-07-25 12:29 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f5e56cf9707a1be547cc29f568d6f60dbdbb1e4c
Log: Fixed bug #72668 (Spurious warning when exception is thrown in user defined function)
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC