Skip to content

Commit 9df531a

Browse files
author
Paweł Farys
authored
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'); ```
1 parent 1ac94be commit 9df531a

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
@@ -802,7 +802,7 @@ Be aware that this encoder will consider keys beginning with ``@`` as attributes
802802
the key ``#comment`` for encoding XML comments::
803803

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

0 commit comments

Comments
 (0)