Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Yep, that looks like a bug in the C syck library. I checked it out using the PHP syck bindings (v 0.9.3): <a href="http://pecl.php.net/package/syck" rel="nofollow noreferrer">http://pecl.php.net/package/syck</a> and the same bug is present, indicating it is a bug in the library as opposed to the ruby yaml library or ruby-syck bindings:</p> <pre><code>// phptestsyck.php &lt;?php $message_text = " X X "; syck_load(syck_dump($message_text)); ?&gt; </code></pre> <p>Running this on the cli gives the same SyckException:</p> <pre><code>$ php phptestsyck.php PHP Fatal error: Uncaught exception 'SyckException' with message 'syntax error on line 5, col 0: 'X'' in /.../phptestsyck.php:8 Stack trace: #0 /.../phptestsyck.php(8): syck_load('--- %YAML:1.0 &gt;...') #1 {main} thrown in /.../phptestsyck.php on line 8 </code></pre> <p>So, I suppose you could try to fix Syck itself. It appears that the library hasn't been updated since v0.55 in May of 2005 (<a href="http://rubyforge.org/projects/syck/" rel="nofollow noreferrer">http://rubyforge.org/projects/syck/</a>), though.</p> <p>Alternately, there is a pure-ruby yaml parser called RbYAML (<a href="http://rbyaml.rubyforge.org/" rel="nofollow noreferrer">http://rbyaml.rubyforge.org/</a>) which originated with JRuby that doesn't appear to have this bug:</p> <pre><code>&gt;&gt; require 'rbyaml' =&gt; true &gt;&gt; message_text = &lt;&lt;END X X END =&gt; "\n X\nX\n" &gt;&gt; yaml = RbYAML.dump(message_text) =&gt; "--- "\\n X\\nX\\n"\n" &gt;&gt; RbYAML.load(yaml) =&gt; "\n X\nX\n" &gt;&gt; </code></pre> <p>Finally, have you considered another serialization format altogether? Ruby's Marshal library doesn't have this bug either and is faster than Yaml (see <a href="http://significantbits.wordpress.com/2008/01/29/yaml-vs-marshal-performance/" rel="nofollow noreferrer">http://significantbits.wordpress.com/2008/01/29/yaml-vs-marshal-performance/</a>):</p> <pre><code>&gt;&gt; message_text = &lt;&lt;END X X END =&gt; "\n X\nX\n" &gt;&gt; marshal = Marshal.dump(message_text) =&gt; "\004\b"\f\n X\nX\n" &gt;&gt; Marshal.load(marshal) =&gt; "\n X\nX\n" </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload