xref: /PHP-8.3/ext/simplexml/tests/bug44478.phpt (revision 7f2f0c00)
1--TEST--
2Bug #44478 (Inconsistent behaviour when assigning new nodes)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7$xml_element = new simpleXMLElement('<root></root>');
8$xml_element->node1 = 'a &#38; b';
9print $xml_element->node1."\n";
10$xml_element->node1 = 'a &#38; b';
11print $xml_element->node1."\n";
12$xml_element->addChild('node2','a &#38; b');
13print $xml_element->node2."\n";
14$xml_element->node2 = 'a & b';
15print $xml_element->node2."\n";
16
17print $xml_element->asXML();
18
19?>
20--EXPECT--
21a &#38; b
22a &#38; b
23a & b
24a & b
25<?xml version="1.0"?>
26<root><node1>a &amp;#38; b</node1><node2>a &amp; b</node2></root>
27
28