Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ffb1a1f

Browse files
committed
ext/sqlite3: SQLite3::close, SQLite3Stmt::close and SQLite3Result::finalize
changed from bool return value to void.
1 parent 674bcca commit ffb1a1f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+55
-97
lines changed

‎UPGRADING‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ PHP 8.3 UPGRADE NOTES
102102
argument is non empty with the class not having constructor.
103103
. pg_insert now raises a ValueError instead of a WARNING when the table specified is invalid.
104104

105+
- Sqlite:
106+
. SQLite3::close, SQLite3Result::finalize and SQLite3Stmt::close are void.
107+
Previously, they always returned true.
108+
105109
- Standard:
106110
. E_NOTICEs emitted by unserialized() have been promoted to E_WARNING.
107111
RFC: https://wiki.php.net/rfc/improve_unserialize_error_handling

‎ext/sqlite3/sqlite3.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@ PHP_METHOD(SQLite3, close)
194194
}
195195
db_obj->initialised = 0;
196196
}
197-
198-
RETURN_TRUE;
199197
}
200198
/* }}} */
201199

@@ -1418,8 +1416,6 @@ PHP_METHOD(SQLite3Stmt, close)
14181416
if(stmt_obj->db_obj) {
14191417
zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlite3_compare_stmt_zval_free);
14201418
}
1421-
1422-
RETURN_TRUE;
14231419
}
14241420
/* }}} */
14251421

@@ -2052,8 +2048,6 @@ PHP_METHOD(SQLite3Result, finalize)
20522048
} else {
20532049
sqlite3_reset(result_obj->stmt_obj->stmt);
20542050
}
2055-
2056-
RETURN_TRUE;
20572051
}
20582052
/* }}} */
20592053

‎ext/sqlite3/sqlite3.stub.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ public function __construct(string $filename, int $flags = SQLITE3_OPEN_READWRIT
311311
/** @tentative-return-type */
312312
public function open(string $filename, int $flags = SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE, string $encryptionKey = ""): void {}
313313

314-
/** @return bool */
315-
public function close() {} // TODO make return type void
314+
/** @tentative-return-type */
315+
public function close(): void {}
316316

317317
/** @tentative-return-type */
318318
public static function version(): array {}
@@ -397,7 +397,7 @@ public function bindValue(string|int $param, mixed $value, int $type = SQLITE3_T
397397
public function clear(): bool {}
398398

399399
/** @tentative-return-type */
400-
public function close(): bool {}
400+
public function close(): void {}
401401

402402
/** @tentative-return-type */
403403
public function execute(): SQLite3Result|false {}
@@ -435,6 +435,6 @@ public function fetchArray(int $mode = SQLITE3_BOTH): array|false {}
435435
/** @tentative-return-type */
436436
public function reset(): bool {}
437437

438-
/** @return bool */
439-
public function finalize() {} // TODO make return type void
438+
/** @tentative-return-type */
439+
public function finalize(): void {}
440440
}

‎ext/sqlite3/sqlite3_arginfo.h‎

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

‎ext/sqlite3/tests/bug47159.phpt‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ require_once(__DIR__ . '/new_db.inc');
99

1010
$stmt = $db->prepare("SELECT 1");
1111

12-
var_dump($stmt->close());
12+
$stmt->close();
1313

14-
var_dump($db->close());
14+
$db->close();
1515

1616
print "done";
1717

1818
?>
1919
--EXPECT--
20-
bool(true)
21-
bool(true)
2220
done

‎ext/sqlite3/tests/bug69972.phpt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $db = new SQLite3(':memory:');
88
echo "SELECTING from invalid table\n";
99
$result = $db->query("SELECT * FROM non_existent_table");
1010
echo "Closing database\n";
11-
var_dump($db->close());
11+
$db->close();
1212
echo "Done\n";
1313

1414
// Trigger the use-after-free
@@ -20,7 +20,6 @@ SELECTING from invalid table
2020

2121
Warning: SQLite3::query(): Unable to prepare statement: 1, no such table: non_existent_table in %sbug69972.php on line %d
2222
Closing database
23-
bool(true)
2423
Done
2524
Error Code: 0
2625
Error Msg:

‎ext/sqlite3/tests/sqlite3_01_open-mb.phpt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ $db = new SQLite3($db_file);
1010
//require_once(__DIR__ . '/new_db.inc');
1111

1212
var_dump($db);
13-
var_dump($db->close());
13+
$db->close();
1414

1515
unlink($db_file);
1616
echo "Done\n";
1717
?>
1818
--EXPECTF--
1919
object(SQLite3)#%d (0) {
2020
}
21-
bool(true)
2221
Done

‎ext/sqlite3/tests/sqlite3_01_open.phpt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ sqlite3
88
require_once(__DIR__ . '/new_db.inc');
99

1010
var_dump($db);
11-
var_dump($db->close());
11+
$db->close();
1212
echo "Done\n";
1313
?>
1414
--EXPECTF--
1515
object(SQLite3)#%d (0) {
1616
}
17-
bool(true)
1817
Done

‎ext/sqlite3/tests/sqlite3_02_create.phpt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ echo "Dropping database\n";
1717
var_dump($db->exec('DROP TABLE test'));
1818

1919
echo "Closing database\n";
20-
var_dump($db->close());
20+
$db->close();
2121
echo "Done\n";
2222
?>
2323
--EXPECTF--
@@ -30,5 +30,4 @@ bool(false)
3030
Dropping database
3131
bool(true)
3232
Closing database
33-
bool(true)
3433
Done

‎ext/sqlite3/tests/sqlite3_03_insert.phpt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ while ($result = $results->fetchArray(SQLITE3_NUM))
2424
$results->finalize();
2525

2626
echo "Closing database\n";
27-
var_dump($db->close());
27+
$db->close();
2828
echo "Done\n";
2929
?>
3030
--EXPECTF--
@@ -47,5 +47,4 @@ array(2) {
4747
string(1) "b"
4848
}
4949
Closing database
50-
bool(true)
5150
Done

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /