xref: /PHP-8.2/ext/pdo_oci/tests/bug54379.phpt (revision 39131219)
1--TEST--
2Bug #54379 (PDO_OCI: UTF-8 output gets truncated)
3--EXTENSIONS--
4pdo
5pdo_oci
6--SKIPIF--
7<?php
8require __DIR__.'/../../pdo/tests/pdo_test.inc';
9if (!preg_match('/charset=.*utf8/i', getenv('PDOTEST_DSN')))
10die('skip not UTF8 DSN');
11PDOTest::skip();
12?>
13--FILE--
14<?php
15require 'ext/pdo/tests/pdo_test.inc';
16$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
17$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
18try {
19        $db->exec("DROP TABLE test");
20} catch (Exception $e) {
21}
22$db->exec("CREATE TABLE test (col1 NVARCHAR2(20))");
23$db->exec("INSERT INTO test VALUES('12345678901234567890')");
24$db->exec("INSERT INTO test VALUES('あいうえおかきくけこさしすせそたちつてと')");
25$stmt = $db->prepare("SELECT * FROM test");
26$stmt->execute();
27var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
28$db->exec("DROP TABLE test");
29?>
30--EXPECT--
31array(2) {
32  [0]=>
33  array(1) {
34    ["col1"]=>
35    string(20) "12345678901234567890"
36  }
37  [1]=>
38  array(1) {
39    ["col1"]=>
40    string(60) "あいうえおかきくけこさしすせそたちつてと"
41  }
42}
43