mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
add a test case for bug 35671
This commit is contained in:
parent
77acc692fd
commit
6387d83a05
45
ext/pdo/tests/bug_35671.phpt
Normal file
45
ext/pdo/tests/bug_35671.phpt
Normal file
@ -0,0 +1,45 @@
|
||||
--TEST--
|
||||
PDO Common: PHP Bug #35671: binding by name breakage
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
if (!extension_loaded('pdo')) die('skip');
|
||||
$dir = getenv('REDIR_TEST_DIR');
|
||||
if (false == $dir) die('skip no driver');
|
||||
require_once $dir . 'pdo_test.inc';
|
||||
PDOTest::skip();
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
|
||||
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
||||
$db = PDOTest::factory();
|
||||
|
||||
$db->exec('CREATE TABLE test (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32))');
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$insert = $db->prepare("insert into test (field1, field2, field3) values (:value1, :value2, :value3)");
|
||||
|
||||
$parm = array(
|
||||
":value1" => 15,
|
||||
":value2" => 20,
|
||||
":value3" => 25
|
||||
);
|
||||
|
||||
$insert->execute($parm);
|
||||
$insert = null;
|
||||
|
||||
var_dump($db->query("SELECT * from test")->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(3) {
|
||||
["field1"]=>
|
||||
string(2) "15"
|
||||
["field2"]=>
|
||||
string(2) "20"
|
||||
["field3"]=>
|
||||
string(2) "25"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user