Skip to content

Commit f0e2406

Browse files
committed
minor #10831 [Serializer] XmlEncoder example fix (vertisan)
This PR was merged into the 4.2 branch. Discussion ---------- [Serializer] XmlEncoder example fix Currently in example: ``` $encoder = new XmlEncoder(); $encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment)); ``` we'll get `Parse error: syntax error, unexpected '', $serialized); ' (T_CONSTANT_ENCAPSED_STRING), expecting ')'`. After close `A comment` string and add missing `$format`, it works correctly. ``` $encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment')), 'xml'); ``` Commits ------- 9df531a XmlEncoder example fix
2 parents f471f5d + 9df531a commit f0e2406

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/serializer.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ Be aware that this encoder will consider keys beginning with ``@`` as attributes
804804
the key ``#comment`` for encoding XML comments::
805805

806806
$encoder = new XmlEncoder();
807-
$encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment));
807+
$encoder->encode(array('foo' => array('@bar' => 'value'), 'qux' => array('#comment' => 'A comment')), 'xml');
808808
// will return:
809809
// <?xml version="1.0"?>
810810
// <response>

0 commit comments

Comments
 (0)