xref: /PHP-8.3/ext/simplexml/tests/bug37386.phpt (revision 7f2f0c00)
1--TEST--
2Bug #39760 (autocreating element doesn't assign value to first node)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$sx1 = new SimpleXMLElement("<root />");
9
10$sx1->node[0] = 'node1';
11$sx1->node[1] = 'node2';
12
13print $sx1->asXML()."\n";
14$node = $sx1->node[0];
15$node[0] = 'New Value';
16
17print $sx1->asXML();
18
19?>
20--EXPECT--
21<?xml version="1.0"?>
22<root><node>node1</node><node>node2</node></root>
23
24<?xml version="1.0"?>
25<root><node>New Value</node><node>node2</node></root>
26