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