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