xref: /php-src/ext/simplexml/tests/gh17153.phpt (revision a57a434f)
1--TEST--
2GH-17153 (SimpleXML crash when using autovivification on document)
3--EXTENSIONS--
4dom
5simplexml
6xsl
7--FILE--
8<?php
9$sxe = simplexml_load_file(__DIR__ . '/../../xsl/tests/53965/collection.xml', SimpleXMLElement::class);
10$processor = new XSLTProcessor;
11$dom = new DOMDocument;
12$dom->load(__DIR__ . '/../../xsl/tests/53965/collection.xsl');
13$processor->importStylesheet($dom);
14$result = $processor->transformToDoc($sxe, SimpleXMLElement::class);
15$result->h = "x";
16var_dump($result);
17?>
18--EXPECT--
19object(SimpleXMLElement)#4 (4) {
20  ["h1"]=>
21  array(2) {
22    [0]=>
23    string(19) "Fight for your mind"
24    [1]=>
25    string(17) "Electric Ladyland"
26  }
27  ["h2"]=>
28  array(2) {
29    [0]=>
30    string(20) "by Ben Harper - 1995"
31    [1]=>
32    string(22) "by Jimi Hendrix - 1997"
33  }
34  ["hr"]=>
35  array(2) {
36    [0]=>
37    object(SimpleXMLElement)#5 (0) {
38    }
39    [1]=>
40    object(SimpleXMLElement)#6 (0) {
41    }
42  }
43  ["h"]=>
44  string(1) "x"
45}
46