<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="http://bugs.horde.org/themes/feed-rss.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
  <title>yaml dumper should quote values with comments</title>
  <pubDate>Sat, 22 Nov 2008 11:51:52 -0500</pubDate>
  <link>http://bugs.horde.org/ticket/6861</link>
  <atom:link rel="self" type="application/rss+xml" title="yaml dumper should quote values with comments" href="http://bugs.horde.org/ticket/6861/rss" />
  <description>yaml dumper should quote values with comments</description>

  
  
  <item>
   <title>I have run into a problem with dumping PHP arrays that conta</title>
   <description>I have run into a problem with dumping PHP arrays that contain &quot;#&quot; characters, which is a comment signifier in YAML. I have a proposed patch:

--- /Users/alanpinstein/Dumper.php.orig 2008-06-09 01:08:54.000000000 -0400
+++ /opt/local/lib/php/Horde/Yaml/Dumper.php    2008-06-09 01:08:57.000000000 -0400
@@ -153,6 +153,11 @@
 
         $spaces = str_repeat(' ', $indent);
 
+        // quote strings if necessary
+        if (strchr($value, '#')) {
+            $value = &quot;'{$value}'&quot;;
+        }
+
         if (is_int($key)) {
             // It's a sequence.
             $string = $spaces . '- ' . $value . &quot;\n&quot;;

There might be more cases, and I don't know if this breaks in the case of folded code, but it's a start for you hopefully. This is a pretty important bug I think because it really breaks YAML dumping if you have this character in a string, which is a common occurrence.</description>
   <pubDate>Mon, 09 Jun 2008 01:12:28 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/6861#t46100</link>
  </item>
  

 </channel>
</rss>
