1--TEST--
2Bug ##76452 (Crash while parsing blob data in firebird_fetch_blob)
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_once "payload_server.inc";
13
14$address = run_server(__DIR__ . "/bug_76452.data");
15
16// no need to change the credentials; we're running against a falke server
17$dsn = "firebird:dbname=inet://$address/test76452";
18$username = 'SYSDBA';
19$password = 'masterkey';
20
21$dbh = new PDO($dsn, $username, $password, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
22$query = $dbh->prepare("SELECT * FROM test76452");
23$query->execute();
24var_dump($query->fetch());
25?>
26--EXPECT--
27array(4) {
28  ["AAA"]=>
29  string(4) "hihi"
30  [0]=>
31  string(4) "hihi"
32  ["BBBB"]=>
33  NULL
34  [1]=>
35  NULL
36}
37