Skip to content

Commit 4dffd7c

Browse files
committed
Use \Exception instead of \RuntimeException
1 parent 94d39b9 commit 4dffd7c

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

ext/sqlite3/sqlite3.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <sqlite3.h>
2929

3030
#include "zend_exceptions.h"
31-
#include "ext/spl/spl_exceptions.h"
3231
#include "SAPI.h"
3332
#include "sqlite3_arginfo.h"
3433

@@ -416,7 +415,7 @@ PHP_METHOD(SQLite3, loadExtension)
416415
}
417416

418417
if (extension_len == 0) {
419-
php_sqlite3_error(db_obj, 0, "Empty string as an extension");
418+
zend_argument_value_error(1, "cannot be empty");
420419
RETURN_FALSE;
421420
}
422421

@@ -2361,7 +2360,7 @@ static void sqlite3_param_dtor(zval *data) /* {{{ */
23612360
PHP_MINIT_FUNCTION(sqlite3)
23622361
{
23632362
/* Register SQLite3Exception class */
2364-
php_sqlite3_exception_ce = register_class_SQLite3Exception(spl_ce_RuntimeException);
2363+
php_sqlite3_exception_ce = register_class_SQLite3Exception(zend_ce_exception);
23652364

23662365
#ifdef ZTS
23672366
/* Refuse to load if this wasn't a threasafe library loaded */
@@ -2428,13 +2427,6 @@ PHP_MINFO_FUNCTION(sqlite3)
24282427
}
24292428
/* }}} */
24302429

2431-
/* {{{ */
2432-
static const zend_module_dep sqlite3_deps[] = {
2433-
ZEND_MOD_REQUIRED("spl")
2434-
ZEND_MOD_END
2435-
};
2436-
/* }}} */
2437-
24382430
/* {{{ PHP_GINIT_FUNCTION */
24392431
static PHP_GINIT_FUNCTION(sqlite3)
24402432
{
@@ -2447,8 +2439,7 @@ static PHP_GINIT_FUNCTION(sqlite3)
24472439

24482440
/* {{{ sqlite3_module_entry */
24492441
zend_module_entry sqlite3_module_entry = {
2450-
STANDARD_MODULE_HEADER_EX,NULL,
2451-
sqlite3_deps,
2442+
STANDARD_MODULE_HEADER,
24522443
"sqlite3",
24532444
NULL,
24542445
PHP_MINIT(sqlite3),

ext/sqlite3/sqlite3.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
const SQLITE3_DETERMINISTIC = UNKNOWN;
6969
#endif
7070

71-
class SQLite3Exception extends \RuntimeException
71+
class SQLite3Exception extends \Exception
7272
{
7373
}
7474

ext/sqlite3/sqlite3_arginfo.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ $db = new SQLite3(':memory:');
2020

2121
try {
2222
$db->loadExtension("");
23-
} catch (Extension $ex) {
23+
} catch (\Throwable $ex) {
2424
var_dump($ex->getMessage());
2525
}
2626

2727
?>
2828
--EXPECTF--
29-
Warning: SQLite3::loadExtension(): Empty string as an extension in %s on line %d
29+
string(61) "SQLite3::loadExtension(): Argument #1 ($name) cannot be empty"

0 commit comments

Comments
 (0)