Skip to content

Commit 9eed321

Browse files
bohwazGirgias
authored andcommitted
Use \Exception instead of \RuntimeException
1 parent 97ac261 commit 9eed321

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

@@ -2363,7 +2362,7 @@ static void sqlite3_param_dtor(zval *data) /* {{{ */
23632362
PHP_MINIT_FUNCTION(sqlite3)
23642363
{
23652364
/* Register SQLite3Exception class */
2366-
php_sqlite3_exception_ce = register_class_SQLite3Exception(spl_ce_RuntimeException);
2365+
php_sqlite3_exception_ce = register_class_SQLite3Exception(zend_ce_exception);
23672366

23682367
#ifdef ZTS
23692368
/* Refuse to load if this wasn't a threasafe library loaded */
@@ -2430,13 +2429,6 @@ PHP_MINFO_FUNCTION(sqlite3)
24302429
}
24312430
/* }}} */
24322431

2433-
/* {{{ */
2434-
static const zend_module_dep sqlite3_deps[] = {
2435-
ZEND_MOD_REQUIRED("spl")
2436-
ZEND_MOD_END
2437-
};
2438-
/* }}} */
2439-
24402432
/* {{{ PHP_GINIT_FUNCTION */
24412433
static PHP_GINIT_FUNCTION(sqlite3)
24422434
{
@@ -2449,8 +2441,7 @@ static PHP_GINIT_FUNCTION(sqlite3)
24492441

24502442
/* {{{ sqlite3_module_entry */
24512443
zend_module_entry sqlite3_module_entry = {
2452-
STANDARD_MODULE_HEADER_EX,NULL,
2453-
sqlite3_deps,
2444+
STANDARD_MODULE_HEADER,
24542445
"sqlite3",
24552446
NULL,
24562447
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)