Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ PHP NEWS
. Fixed PDOStatement::getColumnMeta() reading out of bounds for an invalid
column index. (Ilia Alshanetsky)

- PDO_Firebird:
. Fixed bug GH-23758 (PDO_Firebird returns null for non-null empty BLOBs).
(Lazizbek Ergashev)

- Sockets:
. Fixed socket_select() silently truncating sets larger than FD_SETSIZE on
Windows. (David Carlier)
Expand Down
2 changes: 2 additions & 0 deletions ext/pdo_firebird/firebird_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
52 changes: 52 additions & 0 deletions ext/pdo_firebird/tests/gh23758.phpt
Original file line number Diff line number Diff line change
@@ -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) ""
}
}
Loading