1--TEST--
2XSLTProcessor::transformToDoc return value type error with SimpleXML
3--EXTENSIONS--
4xsl
5simplexml
6--FILE--
7<?php
8
9class AdvancedXMLElement extends SimpleXMLElement {
10    public function foo() {
11        return "foo: " . (string) $this;
12    }
13}
14
15$sxe = simplexml_load_file(__DIR__ . '/53965/collection.xml', AdvancedXMLElement::class);
16
17$processor = new XSLTProcessor;
18$dom = new DOMDocument;
19$dom->load(__DIR__ . '/53965/collection.xsl');
20$processor->importStylesheet($dom);
21$result = $processor->transformToDoc($sxe, AdvancedXMLElement::class);
22
23var_dump($result);
24var_dump($result->h1->foo());
25
26?>
27--EXPECT--
28object(AdvancedXMLElement)#4 (3) {
29  ["h1"]=>
30  array(2) {
31    [0]=>
32    string(19) "Fight for your mind"
33    [1]=>
34    string(17) "Electric Ladyland"
35  }
36  ["h2"]=>
37  array(2) {
38    [0]=>
39    string(20) "by Ben Harper - 1995"
40    [1]=>
41    string(22) "by Jimi Hendrix - 1997"
42  }
43  ["hr"]=>
44  array(2) {
45    [0]=>
46    object(AdvancedXMLElement)#5 (0) {
47    }
48    [1]=>
49    object(AdvancedXMLElement)#6 (0) {
50    }
51  }
52}
53string(24) "foo: Fight for your mind"
54