xref: /PHP-8.0/ext/pdo/tests/bug_36428.phpt (revision a555cc0b)
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--EXPECTF--
25array(1) {
26  [0]=>
27  object(SimpleXMLElement)#%d (1) {
28    ["a"]=>
29    string(3) "xyz"
30  }
31}
32