xref: /PHP-5.6/ext/pdo/tests/bug_65946.phpt (revision 9a87108e)
1--TEST--
2PDO Common: Bug #65946 (pdo_sql_parser.c permanently converts values bound to strings)
3--SKIPIF--
4<?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$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
17$db->exec('CREATE TABLE test(id int)');
18$db->exec('INSERT INTO test VALUES(1)');
19$stmt = $db->prepare('SELECT * FROM test LIMIT :limit');
20$stmt->bindValue('limit', 1, PDO::PARAM_INT);
21if(!($res = $stmt->execute())) var_dump($stmt->errorInfo());
22if(!($res = $stmt->execute())) var_dump($stmt->errorInfo());
23var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
24?>
25--EXPECTF--
26array(1) {
27  [0]=>
28  array(1) {
29    ["id"]=>
30    string(1) "1"
31  }
32}
33