spyc 0.3 does value testing for ':' and '-' in the following way:
if (strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false) {
This fails for values like 'from:', because the trailing space just isn't there.
So here is my proposed fix:
--- /data/home/aljoscha/Desktop/spyc/spyc.php 2007-05-08 23:47:54.000000000 +0200
+++ lib/php/spyc.php 2007-07-03 14:23:00.915770385 +0200
@@ -198,7 +198,7 @@
*/
function _dumpNode($key,$value,$indent) {
// do some folding here, for blocks
- if (strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false) {
+ if (strpos($value,"\n") !== false || strpos($value,":") !== false || strpos($value,"-") !== false) {
$value = $this->_doLiteralBlock($value,$indent);
} else {
$value = $this->_doFolding($value,$indent);
It checks for the bare characters ':' and '-', so that dumping array('foo' => 'bar', 'bee' => 'baz:') to YAML will work.
Patch for spyc.php