summaryrefslogtreecommitdiff
path: root/ext/pdo_firebird/tests/bug_76488.phpt
blob: dba6734c28b5c95c77f80c6432e9f6a462910de7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field
--SKIPIF--
<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?>
--FILE--
<?php
require 'testdb.inc';
$dbh = new PDO('firebird:dbname='.$test_base, $user, $password) or die;

$sql = '
with recursive r(n) as (
  select 1 from rdb$database
  union all
  select n+1 from r where n < 1000
)
select n,
       cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC
from r 
';

    for ($i = 0; $i < 10; $i++) {
        $sth = $dbh->prepare($sql);
        $sth->execute();          
        $rows = $sth->fetchAll();
	    unset($rows);
	    unset($sth);
    }
    unset($dbh);
    echo "OK";
?>
--EXPECT--
OK