Skip to content

Commit 68f45c5

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4: Fix phpGH-23758: PDO_Firebird returns null for empty BLOBs (php#23763)
2 parents 026e667 + 48c0ffa commit 68f45c5

3 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎NEWS‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ PHP NEWS
102102
. Fixed bug GH-23962 (Destroying a persistent PDO instance rolls back a
103103
transaction still in use by another instance). (Lazizbek Ergashev)
104104

105+
- PDO_Firebird:
106+
. Fixed bug GH-23758 (PDO_Firebird returns null for non-null empty BLOBs).
107+
(Lazizbek Ergashev)
108+
105109
- PGSQL:
106110
. Fixed pg_lo_write() rejecting data containing null bytes. (Ilia Alshanetsky)
107111
. Removed pg_service(), unavailable with any released libpq. (KentarouTakeda)

‎ext/pdo_firebird/firebird_statement.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ static int php_firebird_fetch_blob(pdo_stmt_t *stmt, int colno, zval *result, IS
438438
php_firebird_error_stmt_with_info(stmt, "HY000", strlen("HY000"), msg, strlen(msg));
439439
goto fetch_blob_end;
440440
}
441+
} else {
442+
ZVAL_EMPTY_STRING(result);
441443
}
442444
retval = 1;
443445

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--TEST--
2+
GH-23758 (PDO_Firebird returns null for non-null empty BLOBs)
3+
--EXTENSIONS--
4+
pdo_firebird
5+
--SKIPIF--
6+
<?php require('skipif.inc'); ?>
7+
--XLEAK--
8+
A bug in firebird causes a memory leak when calling `isc_attach_database()`.
9+
See https://github.com/FirebirdSQL/firebird/issues/7849
10+
--FILE--
11+
<?php
12+
13+
require("testdb.inc");
14+
15+
$dbh = getDbConnection();
16+
$dbh->exec('CREATE TABLE gh23758 (ID INTEGER, BIN_VAL BLOB SUB_TYPE BINARY, TEXT_VAL BLOB SUB_TYPE TEXT)');
17+
18+
$stmt = $dbh->prepare('INSERT INTO gh23758 VALUES (?, ?, ?)');
19+
$stmt->execute([1, null, null]);
20+
$stmt->execute([2, '', '']);
21+
22+
$stmt = $dbh->query('SELECT BIN_VAL, TEXT_VAL FROM gh23758 ORDER BY ID');
23+
var_dump($stmt->fetchAll(PDO::FETCH_NUM));
24+
25+
unset($stmt);
26+
unset($dbh);
27+
28+
?>
29+
--CLEAN--
30+
<?php
31+
require 'testdb.inc';
32+
$dbh = getDbConnection();
33+
@$dbh->exec('DROP TABLE gh23758');
34+
unset($dbh);
35+
?>
36+
--EXPECT--
37+
array(2) {
38+
[0]=>
39+
array(2) {
40+
[0]=>
41+
NULL
42+
[1]=>
43+
NULL
44+
}
45+
[1]=>
46+
array(2) {
47+
[0]=>
48+
string(0) ""
49+
[1]=>
50+
string(0) ""
51+
}
52+
}

0 commit comments

Comments
 (0)