ソースを参照

Merge pull request #68 from richardfullmer/patch-1

Add forgotten sprintf support for thrown exceptions in XmlSerializationV...
Johannes 13 年 前
コミット
4039b6a377
1 ファイル変更2 行追加2 行削除
  1. 2 2
      Serializer/XmlSerializationVisitor.php

+ 2 - 2
Serializer/XmlSerializationVisitor.php

@@ -157,7 +157,7 @@ class XmlSerializationVisitor extends AbstractSerializationVisitor
         if ($metadata->xmlAttribute) {
             $node = $this->navigator->accept($v, null, $this);
             if (!$node instanceof \DOMCharacterData) {
-                throw new RuntimeException('Unsupported value for XML attribute. Expected character data, but got %s.', json_encode($v));
+                throw new RuntimeException(sprintf('Unsupported value for XML attribute. Expected character data, but got %s.', json_encode($v)));
             }
 
             $this->currentNode->setAttribute($this->namingStrategy->translateName($metadata), $node->nodeValue);
@@ -175,7 +175,7 @@ class XmlSerializationVisitor extends AbstractSerializationVisitor
 
             $node = $this->navigator->accept($v, null, $this);
             if (!$node instanceof \DOMCharacterData) {
-                throw new RuntimeException('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, is_object($node) ? get_class($node) : gettype($node));
+                throw new RuntimeException(sprintf('Unsupported value for property %s::$%s. Expected character data, but got %s.', $metadata->reflection->class, $metadata->reflection->name, is_object($node) ? get_class($node) : gettype($node)));
             }
 
             $this->currentNode->appendChild($node);