1--TEST--
2PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field
3--EXTENSIONS--
4pdo_firebird
5--SKIPIF--
6<?php require('skipif.inc'); ?>
7--XLEAK--
8A bug in firebird causes a memory leak when calling `isc_attach_database()`.
9See https://github.com/FirebirdSQL/firebird/issues/7849
10--FILE--
11<?php
12require 'testdb.inc';
13
14$sql = '
15with recursive r(n) as (
16  select 1 from rdb$database
17  union all
18  select n+1 from r where n < 1000
19)
20select n,
21       cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC
22from r
23';
24
25$dbh = getDbConnection();
26
27for ($i = 0; $i < 10; $i++) {
28    $sth = $dbh->prepare($sql);
29    $sth->execute();
30    $rows = $sth->fetchAll();
31    unset($rows);
32    unset($sth);
33}
34unset($dbh);
35echo "OK";
36?>
37--EXPECT--
38OK
39