From 938408c9f1aac0aead02012aac0507a29b3979c9 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 18 Jan 2026 21:11:10 +0000 Subject: [PATCH 1/2] ext/sqlite3: Sqlite3::openBlob() code path simplification. since the stream is opened in non persistent mode, the failure code path is dead (so are the missing leaks fixes). --- ext/sqlite3/sqlite3.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index da24b037861a8..cf2fad6481af2 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1270,13 +1270,9 @@ PHP_METHOD(SQLite3, openBlob) mode = "r+b"; } + // since it is not persistent, php_stream_alloc can't fail stream = php_stream_alloc(&php_stream_sqlite3_ops, sqlite3_stream, 0, mode); - - if (stream) { - php_stream_to_zval(stream, return_value); - } else { - RETURN_FALSE; - } + php_stream_to_zval(stream, return_value); } /* }}} */ From 0dd46aa019f26d73d5b8caede78356e677a92b12 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 19 Jan 2026 05:55:40 +0000 Subject: [PATCH 2/2] review --- ext/sqlite3/sqlite3.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index cf2fad6481af2..6d55409ca45aa 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1272,6 +1272,7 @@ PHP_METHOD(SQLite3, openBlob) // since it is not persistent, php_stream_alloc can't fail stream = php_stream_alloc(&php_stream_sqlite3_ops, sqlite3_stream, 0, mode); + ZEND_ASSERT(stream != NULL); php_stream_to_zval(stream, return_value); } /* }}} */