xref: /PHP-8.4/ext/pdo/tests/bug_36428.phpt (revision f4a5db3e)
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 test36428 (a VARCHAR(10))");
20$db->exec("INSERT INTO test36428 (a) VALUES ('xyz')");
21$res = $db->query("SELECT a FROM test36428");
22var_dump($res->fetchAll(PDO::FETCH_CLASS|PDO::FETCH_PROPS_LATE, 'SimpleXMLElement', array('<root/>')));
23
24?>
25--CLEAN--
26<?php
27require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
28$db = PDOTest::factory();
29PDOTest::dropTableIfExists($db, "test36428");
30?>
31--EXPECTF--
32array(1) {
33  [0]=>
34  object(SimpleXMLElement)#%d (1) {
35    ["a"]=>
36    string(3) "xyz"
37  }
38}
39