xref: /PHP-7.4/ext/simplexml/tests/bug38406.phpt (revision 782352c5)
1--TEST--
2Bug #38406 (crash when assigning objects to SimpleXML attributes)
3--SKIPIF--
4<?php if (!extension_loaded("simplexml")) print "skip"; ?>
5--FILE--
6<?php
7
8$item = new SimpleXMLElement('<something />');
9$item->attribute = 'something';
10var_dump($item->attribute);
11
12$item->otherAttribute = $item->attribute;
13var_dump($item->otherAttribute);
14
15$a = array();
16$item->$a = new stdclass;
17
18echo "Done\n";
19?>
20--EXPECTF--
21object(SimpleXMLElement)#%d (1) {
22  [0]=>
23  string(9) "something"
24}
25object(SimpleXMLElement)#%d (1) {
26  [0]=>
27  string(9) "something"
28}
29
30Notice: Array to string conversion in %s on line %d
31
32Warning: It is not yet possible to assign complex types to properties in %s on line %d
33Done
34