xref: /php-src/ext/simplexml/tests/bug38424.phpt (revision 7f2f0c00)
1--TEST--
2Bug #38424 (Different attribute assignment if new or exists)
3--EXTENSIONS--
4simplexml
5--FILE--
6<?php
7
8$xml = simplexml_load_string('<xml></xml>');
9
10$str = "abc & def" ;
11
12$xml["a1"] = "" ;
13$xml["a1"] = htmlspecialchars($str,ENT_NOQUOTES) ;
14
15$xml["a2"] = htmlspecialchars($str,ENT_NOQUOTES) ;
16
17$xml["a3"] = "" ;
18$xml["a3"] = $str ;
19
20$xml["a4"] = $str ;
21
22echo $xml->asXML();
23?>
24--EXPECT--
25<?xml version="1.0"?>
26<xml a1="abc &amp;amp; def" a2="abc &amp;amp; def" a3="abc &amp; def" a4="abc &amp; def"/>
27