[php-src] Issue #14846: 在用simplex ml_load_string时调用asXML会改变原有xm l文本格式

From: Date: Sat, 06 Jul 2024 19:01:38 +0000
Subject: [php-src] Issue #14846: 在用simplex ml_load_string时调用asXML会改变原有xm l文本格式
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247238@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14846 Author: LinghongJiang ### Description ```php <?php $xml = '<?xml version="1.0" encoding="UTF-8"?><root><teenMode>0</teenMode><M-Value>V/WvP1WCRxH9uDe6ZW6VrA== </M-Value><uid>5470686000</uid><qq>861683052</qq> <item cmd="1" optime="1714311948" QQ="861683052"/></root>'; $post_body = simplexml_load_string($xml); $post_body->item['QQ'] = 99408162; $post_body = $post_body->asXML();//Return a well-formed XML string based on SimpleXML element print_r($post_body); ``` 上面返回的结果 ``` <?xml version="1.0" encoding="UTF-8"?> <root><teenMode>0</teenMode><M-Value>V/WvP1WCRxH9uDe6ZW6VrA== </M-Value><uid>5470686000</uid><qq>861683052</qq> <item cmd="1" optime="1714311948" QQ="99408162"/></root> 应该返回的结果 <?xml version="1.0" encoding="UTF-8"?><root><teenMode>0</teenMode><M-Value>V/WvP1WCRxH9uDe6ZW6VrA== </M-Value><uid>5470686000</uid><qq>99408162</qq> <item cmd="1" optime="1714311948" QQ="861683052"/></root> ``` 在调用asXML后 <?xml version="1.0" encoding="UTF-8"?> 和后面的内容是紧跟其后在一起的,而非原来的格式。

« previous php.bugs (#247238) next »