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