xref: /PHP-8.3/ext/pdo/tests/bug_35671.phpt (revision 74859783)
1--TEST--
2PDO Common: Bug #35671 (binding by name breakage)
3--EXTENSIONS--
4pdo
5--SKIPIF--
6<?php
7$dir = getenv('REDIR_TEST_DIR');
8if (false == $dir) die('skip no driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16$db = PDOTest::factory();
17
18$db->exec('CREATE TABLE test (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32))');
19$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
20
21$insert = $db->prepare("insert into test (field1, field2, field3) values (:value1, :value2, :value3)");
22
23$parm = array(
24    ":value1" => 15,
25    ":value2" => 20,
26    ":value3" => 25
27);
28
29$insert->execute($parm);
30$insert = null;
31
32var_dump($db->query("SELECT * from test")->fetchAll(PDO::FETCH_ASSOC));
33
34?>
35--EXPECT--
36array(1) {
37  [0]=>
38  array(3) {
39    ["field1"]=>
40    string(2) "15"
41    ["field2"]=>
42    string(2) "20"
43    ["field3"]=>
44    string(2) "25"
45  }
46}
47