xref: /PHP-8.0/ext/pdo_mysql/tests/bug_37445.phpt (revision 0f369817)
1--TEST--
2PDO MySQL Bug #37445 (Premature stmt object destruction)
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
6require __DIR__ . '/config.inc';
7require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
8PDOTest::skip();
9?>
10--FILE--
11<?php
12require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
13$db = PDOTest::test_factory(__DIR__ . '/common.phpt');
14
15$db->setAttribute(PDO :: ATTR_EMULATE_PREPARES, true);
16$stmt = $db->prepare("SELECT 1");
17$stmt->bindParam(':a', 'b');
18?>
19--EXPECTF--
20Fatal error: Uncaught Error: PDOStatement::bindParam(): Argument #2 ($var) cannot be passed by reference in %sbug_37445.php:%d
21Stack trace:
22#0 {main}
23  thrown in %sbug_37445.php on line %d
24