Author: fabien
Date: 2010-02-22 12:00:09 +0100 (Mon, 22 Feb 2010)
New Revision: 28176

Modified:
   branches/2.0/src/Symfony/Components/Yaml/Parser.php
Log:
Merge branch 'master' of git://github.com/symfony/symfony

Modified: branches/2.0/src/Symfony/Components/Yaml/Parser.php
===================================================================
--- branches/2.0/src/Symfony/Components/Yaml/Parser.php 2010-02-22 10:45:09 UTC 
(rev 28175)
+++ branches/2.0/src/Symfony/Components/Yaml/Parser.php 2010-02-22 11:00:09 UTC 
(rev 28176)
@@ -19,7 +19,6 @@
  */
 class Parser
 {
-  protected $value          = '';
   protected $offset         = 0;
   protected $lines          = array();
   protected $currentLineNb  = -1;
@@ -47,10 +46,9 @@
    */
   public function parse($value)
   {
-    $this->value = $this->cleanup($value);
     $this->currentLineNb = -1;
     $this->currentLine = '';
-    $this->lines = explode("\n", $this->value);
+    $this->lines = explode("\n", $this->cleanup($value));
 
     $data = array();
     while ($this->moveToNextLine())
@@ -191,8 +189,7 @@
       }
       else
       {
-        // one liner?
-        if (1 == count(explode("\n", rtrim($this->value, "\n"))))
+        if (1 == count($this->lines))
         {
           $value = Inline::load($this->lines[0]);
           if (is_array($value))
@@ -543,10 +540,8 @@
   {
     $value = str_replace(array("\r\n", "\r"), "\n", $value);
 
-    if (!preg_match("#\n$#", $value))
-    {
-      $value .= "\n";
-    }
+    // remove trailing newlines
+    $value = rtrim($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