| Summary | yaml dumper should quote values with comments |
| Queue | Horde Framework Packages |
| Queue Version | FRAMEWORK_3 |
| Type | Bug |
| State | Assigned |
| Priority | 1. Low |
| Owners | Mike Naberezny <mike (at) naberezny (dot) com>, Chuck Hagenbuch <chuck (at) horde (dot) org> |
| Requester | apinstein (at) mac (dot) com |
| Created | 06/09/2008 (90 days ago) |
| Due | |
| Updated | 06/09/2008 (90 days ago) |
| Assigned | 06/09/2008 (90 days ago) |
| Resolved | |
| Attachments | |
| Milestone | |
| Patch | No |
Assigned to Chuck Hagenbuch
Patch ⇒
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ yaml dumper should quote values with comments
Type ⇒ Bug
Priority ⇒ 1. Low
State ⇒ Unconfirmed
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 = "'{$value}'";
+ }
+
if (is_int($key)) {
// It's a sequence.
$string = $spaces . '- ' . $value . "\n";
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.