xref: /PHP-8.3/ext/pdo_mysql/tests/bug67004.phpt (revision b5a14e6c)
1--TEST--
2Bug #67004: Executing PDOStatement::fetch() more than once prevents releasing resultset
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12
13require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc');
14$dbh = MySQLPDOTest::factory();
15$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
16$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
17$dbh->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
18$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
19$stmt = $dbh->prepare("SELECT ?");
20
21$stmt->execute(["foo"]);
22var_dump($stmt->fetchColumn(0));
23
24$stmt->execute(["bar"]);
25var_dump($stmt->fetchColumn(0));
26
27$stmt = $dbh->prepare("SELECT ?");
28$stmt->execute(["baz"]);
29var_dump($stmt->fetchColumn(0));
30
31?>
32--EXPECT--
33string(3) "foo"
34string(3) "bar"
35string(3) "baz"
36