Development

Changeset 28176

You must first sign up to be able to contribute.

Changeset 28176

Show
Ignore:
Timestamp:
02/22/10 12:00:09 (3 years ago)
Author:
fabien
Message:

Merge branch 'master' of git://github.com/symfony/symfony

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2.0/src/Symfony/Components/Yaml/Parser.php

    r27919 r28176  
    2020class Parser 
    2121{ 
    22   protected $value          = ''; 
    2322  protected $offset         = 0; 
    2423  protected $lines          = array(); 
     
    4847  public function parse($value) 
    4948  { 
    50     $this->value = $this->cleanup($value); 
    5149    $this->currentLineNb = -1; 
    5250    $this->currentLine = ''; 
    53     $this->lines = explode("\n", $this->value); 
     51    $this->lines = explode("\n", $this->cleanup($value)); 
    5452 
    5553    $data = array(); 
     
    192190      else 
    193191      { 
    194         // one liner? 
    195         if (1 == count(explode("\n", rtrim($this->value, "\n")))) 
     192        if (1 == count($this->lines)) 
    196193        { 
    197194          $value = Inline::load($this->lines[0]); 
     
    544541    $value = str_replace(array("\r\n", "\r"), "\n", $value); 
    545542 
    546     if (!preg_match("#\n$#", $value)) 
    547     { 
    548       $value .= "\n"; 
    549     } 
     543    // remove trailing newlines 
     544    $value = rtrim($value, "\n"); 
    550545 
    551546    // strip YAML header