Author: FabianLange
Date: 2010-02-22 14:33:56 +0100 (Mon, 22 Feb 2010)
New Revision: 28183

Modified:
   components/yaml/branches/1.0/lib/sfYamlParser.php
Log:
[yaml] fixed missing newline in sfYamlParser when parsing certain symfony core 
files (fixes #8321)

Modified: components/yaml/branches/1.0/lib/sfYamlParser.php
===================================================================
--- components/yaml/branches/1.0/lib/sfYamlParser.php   2010-02-22 12:23:34 UTC 
(rev 28182)
+++ components/yaml/branches/1.0/lib/sfYamlParser.php   2010-02-22 13:33:56 UTC 
(rev 28183)
@@ -196,7 +196,8 @@
       }
       else
       {
-        if (1 == count($this->lines))
+        // 1-liner followed by newline
+        if (2 == count($this->lines) && empty($this->lines[1]))
         {
           $value = sfYamlInline::load($this->lines[0]);
           if (is_array($value))
@@ -547,8 +548,10 @@
   {
     $value = str_replace(array("\r\n", "\r"), "\n", $value);
 
-    // remove trailing newlines
-    $value = rtrim($value, "\n");
+    if (!preg_match("#\n$#", $value))
+    {
+      $value .= "\n";
+    }
 
     // strip YAML header
     preg_replace('#^\%YAML[: ][\d\.]+.*\n#s', '', $value);

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to