[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Saki Takamachi | Date: | Tue, 29 Sep 2026 11:55:56 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141674@lists.php.net to get a copy of this message | ||
Author: Saki Takamachi (SakiTakamachi)
Date: 2026-09-29T20:50:46+09:00
Commit: https://github.com/php/php-src/commit/68f45c564f8a724cbf569858734349364038d72a
Raw diff: https://github.com/php/php-src/commit/68f45c564f8a724cbf569858734349364038d72a.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix GH-23758: PDO_Firebird returns null for empty BLOBs (#23763)
Changed paths:
A ext/pdo_firebird/tests/gh23758.phpt
M NEWS
M ext/pdo_firebird/firebird_statement.c
Diff:
diff --git a/NEWS b/NEWS
index 0f2af2c21ca9..1b495b2d5074 100644
--- a/NEWS
+++ b/NEWS
@@ -102,6 +102,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)
+
- PGSQL:
. Fixed pg_lo_write() rejecting data containing null bytes. (Ilia Alshanetsky)
. Removed pg_service(), unavailable with any released libpq. (KentarouTakeda)
diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c
index d506aa69eed3..dce20ad87c08 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -438,6 +438,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 000000000000..5f90d2ddbc8b
--- /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) ""
+ }
+}