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