Home » XML » XML_Serializer » Bug #8534
empty string treated like null ?
Details
| Request #8534 | empty string treated like null ? |
|---|---|
| Submitted | 2006-08-22 14:53 UTC |
| From | gillou_garou at yahoo dot fr |
| Status | Wont fix |
| Package | XML_Serializer |
| PHP Version | 4.4.2 |
| OS | linux |
| Roadmaps | (Not assigned) |
Comments
[2006-08-22 14:53 UTC] gillou_garou at yahoo dot fr
Description:
------------
My problem is that an empty string is treated the same way as null value. If i put an empty string as an array value, when serializing with option "cdata", i'd like the serializer to generate an empty cdata tag :
like :
<tag><![CDATA[]]></tag>
instead of just :
<tag />
Test script:
---------------
$tab["tag"]="";
$serializer_options = array (
'addDecl' => TRUE,
'encoding' => 'UTF-8',
'indent' => ' ',
'rootName' => 'root',
'scalarAsAttributes' => FALSE,
'cdata'=> TRUE,
'encodeFunction' => "utf8_encode"
);
$Serializer = &new XML_Serializer($serializer_options);
$Serializer->serialize($tab);
echo($Serializer->getSerializedData());
Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<root>
<tag><![CDATA[]]></tag>
</root>
Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<root>
<tag />
</root>