xref: /PHP-5.3/ext/pdo/tests/bug_36798.phpt (revision 4840a4a2)
1--TEST--
2PDO Common: Bug #36798 (Error parsing named parameters with queries containing high-ascii chars)
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
11if (!strncasecmp(getenv('PDOTEST_DSN'), 'oci', strlen('oci'))){
12    if (!strpos(strtolower(getenv('PDOTEST_DSN')), 'charset=we8mswin1252')) die('skip expected output valid for Oracle with WE8MSWIN1252 character set');
13
14}
15
16?>
17--FILE--
18<?php
19
20if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
21require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
22$db = PDOTest::factory();
23
24@$db->exec("SET NAMES 'LATIN1'"); // needed for PostgreSQL
25$db->exec("CREATE TABLE test (id INTEGER)");
26$db->exec("INSERT INTO test (id) VALUES (1)");
27
28$stmt = $db->prepare("SELECT '�' as test FROM test WHERE id = :id");
29$stmt->execute(array(":id" => 1));
30
31$row = $stmt->fetch(PDO::FETCH_NUM);
32var_dump( $row );
33
34?>
35--EXPECT--
36array(1) {
37  [0]=>
38  string(1) "�"
39}
40