Commit 48c0ffa8999 for php

commit 48c0ffa899934f2d24dbef5e385b3a6ffce72eab
Author: lazerg <lazerg2@gmail.com>
Date:   Sat Sep 19 02:01:05 2026 +0500

    Fix GH-23758: PDO_Firebird returns null for empty BLOBs (#23763)

    Fixes #23758
    Closes #23763

diff --git a/NEWS b/NEWS
index 7468a698253..2e5b71aa8fc 100644
--- a/NEWS
+++ b/NEWS
@@ -103,6 +103,10 @@ PHP                                                                        NEWS
   . Fixed bug GH-23962 (Destroying a persistent PDO instance rolls back a
     transaction still in use by another instance). (Lazizbek Ergashev)

+- PDO_Firebird:
+  . Fixed bug GH-23758 (PDO_Firebird returns null for non-null empty BLOBs).
+    (Lazizbek Ergashev)
+
 - Readline:
   . Fixed a heap over-read in the interactive shell prompt when cli.prompt is
     set to an empty string. (Ilia Alshanetsky)
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index 50db5594769..b8802751bf9 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -446,6 +446,8 @@ static int php_firebird_fetch_blob(pdo_stmt_t *stmt, int colno, zval *result, IS
 			php_firebird_error_stmt_with_info(stmt, "HY000", strlen("HY000"), msg, strlen(msg));
 			goto fetch_blob_end;
 		}
+	} else {
+		ZVAL_EMPTY_STRING(result);
 	}
 	retval = 1;

diff --git a/ext/pdo_firebird/tests/gh23758.phpt b/ext/pdo_firebird/tests/gh23758.phpt
new file mode 100644
index 00000000000..5f90d2ddbc8
--- /dev/null
+++ b/ext/pdo_firebird/tests/gh23758.phpt
@@ -0,0 +1,52 @@
+--TEST--
+GH-23758 (PDO_Firebird returns null for non-null empty BLOBs)
+--EXTENSIONS--
+pdo_firebird
+--SKIPIF--
+<?php require('skipif.inc'); ?>
+--XLEAK--
+A bug in firebird causes a memory leak when calling `isc_attach_database()`.
+See https://github.com/FirebirdSQL/firebird/issues/7849
+--FILE--
+<?php
+
+require("testdb.inc");
+
+$dbh = getDbConnection();
+$dbh->exec('CREATE TABLE gh23758 (ID INTEGER, BIN_VAL BLOB SUB_TYPE BINARY, TEXT_VAL BLOB SUB_TYPE TEXT)');
+
+$stmt = $dbh->prepare('INSERT INTO gh23758 VALUES (?, ?, ?)');
+$stmt->execute([1, null, null]);
+$stmt->execute([2, '', '']);
+
+$stmt = $dbh->query('SELECT BIN_VAL, TEXT_VAL FROM gh23758 ORDER BY ID');
+var_dump($stmt->fetchAll(PDO::FETCH_NUM));
+
+unset($stmt);
+unset($dbh);
+
+?>
+--CLEAN--
+<?php
+require 'testdb.inc';
+$dbh = getDbConnection();
+@$dbh->exec('DROP TABLE gh23758');
+unset($dbh);
+?>
+--EXPECT--
+array(2) {
+  [0]=>
+  array(2) {
+    [0]=>
+    NULL
+    [1]=>
+    NULL
+  }
+  [1]=>
+  array(2) {
+    [0]=>
+    string(0) ""
+    [1]=>
+    string(0) ""
+  }
+}