Skip to content

Commit

Permalink
[Serializer] fixed XmlEncoder for single char tags
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Mar 12, 2011
1 parent f6c119c commit 411a382
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/Serializer/Encoder/XmlEncoder.php
Expand Up @@ -296,6 +296,6 @@ protected function isElementNameValid($name)
{
return $name &&
false === strpos($name, ' ') &&
preg_match('#^[\pL_][\pL0-9._-]+$#ui', $name);
preg_match('#^[\pL_][\pL0-9._-]*$#ui', $name);
}
}
Expand Up @@ -66,7 +66,8 @@ public function testAttributes()
'@Type' => 'test'
),
'föo_bär' => '',
"Bar" => array(1,2,3)
"Bar" => array(1,2,3),
'a' => 'b',
);
$expected = '<?xml version="1.0"?>'."\n".
'<response>'.
Expand All @@ -76,6 +77,7 @@ public function testAttributes()
'<Bar>1</Bar>'.
'<Bar>2</Bar>'.
'<Bar>3</Bar>'.
'<a><![CDATA[b]]></a>'.
'</response>'."\n";
$this->assertEquals($expected, $this->encoder->encode($obj, 'xml'));
}
Expand Down

0 comments on commit 411a382

Please sign in to comment.