xref: /PHP-7.4/ext/pdo/tests/bug_36428.phpt (revision 26dfce7f)
1--TEST--
2PDO Common: Bug #36428 (Incorrect error message for PDO::fetchAll())
3--SKIPIF--
4<?php
5if (!extension_loaded('pdo')) die('skip');
6if (!extension_loaded('simplexml')) die('skip SimpleXML not loaded');
7$dir = getenv('REDIR_TEST_DIR');
8if (false == $dir) die('skip no driver');
9require_once $dir . 'pdo_test.inc';
10PDOTest::skip();
11?>
12--FILE--
13<?php
14if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
15require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
16
17$db = PDOTest::factory();
18$db->exec("CREATE TABLE test (a VARCHAR(10))");
19$db->exec("INSERT INTO test (a) VALUES ('xyz')");
20$res = $db->query("SELECT a FROM test");
21var_dump($res->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'SimpleXMLElement', array('<root/>')));
22
23?>
24===DONE===
25--EXPECTF--
26array(1) {
27  [0]=>
28  object(SimpleXMLElement)#%d (1) {
29    ["a"]=>
30    string(3) "xyz"
31  }
32}
33===DONE===
34