|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
[2019-08-13 20:59 UTC] erik at coretech dot se
[2019-10-02 06:17 UTC] krakjoe@php.net
[2019-10-02 06:17 UTC] krakjoe@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
Description: ------------ When I parses a validating XML with simplexml_load_string(), and this XML have an element filled only with spaces, the parser find an array of string instead of a string. Test script: --------------- $xmlpost = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results> <row> <firstname>THIERRY</firstname> <address1> </address1> <address2/> </row> </results> '; $xml = simplexml_load_string($xmlpost); echo '<pre>'; var_dump($xml); echo '</pre>'; Expected result: ---------------- object(SimpleXMLElement)#1 (1) { ["row"]=> object(SimpleXMLElement)#2 (3) { ["firstname"]=> string(7) "THIERRY" ["address1"]=> string(3) " " ["address2"]=> object(SimpleXMLElement)#3 (0) { } } } Actual result: -------------- object(SimpleXMLElement)#1 (1) { ["row"]=> object(SimpleXMLElement)#2 (3) { ["firstname"]=> string(7) "THIERRY" ["address1"]=> object(SimpleXMLElement)#3 (1) { [0]=> string(3) " " } ["address2"]=> object(SimpleXMLElement)#4 (0) { } } }