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