mirror of
https://github.com/php/php-src.git
synced 2024-12-21 16:00:18 +08:00
b7c2eb3228
all single SimpleXMLElements are addressable using offset 0 use correct node for xpath context node add test
26 lines
559 B
PHP
26 lines
559 B
PHP
--TEST--
|
|
Bug #39760 (autocreating element doesn't assign value to first node)
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$sx1 = new SimpleXMLElement((binary)"<root />");
|
|
|
|
$sx1->node[0] = 'node1';
|
|
$sx1->node[1] = 'node2';
|
|
|
|
print $sx1->asXML()."\n";
|
|
$node = $sx1->node[0];
|
|
$node[0] = 'New Value';
|
|
|
|
print $sx1->asXML();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
<?xml version="1.0"?>
|
|
<root><node>node1</node><node>node2</node></root>
|
|
|
|
<?xml version="1.0"?>
|
|
<root><node>New Value</node><node>node2</node></root>
|