Bug #72668 [NEW]: Spurious warning when exception is thrown in user defined function
| From: | cmb@php.net | Date: | Mon, 25 Jul 2016 12:10:42 +0000 |
| Subject: | Bug #72668 [NEW]: Spurious warning when exception is thrown in user defined function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202575@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.1.0beta1
Package: SQLite related
Bug Type: Bug
Bug description:Spurious warning when exception is thrown in user defined function
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
--
Edit bug report at https://bugs.php.net/bug.php?id=72668&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72668&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72668&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72668&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72668&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72668&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72668&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72668&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72668&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72668&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72668&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72668&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72668&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72668&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72668&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72668&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72668&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72668&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72668&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72668&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72668&r=mysqlcfg