diff --git a/phpunit b/phpunit index 0f5aab29b1..4aa5dbd302 100755 --- a/phpunit +++ b/phpunit @@ -1,7 +1,10 @@ #!/usr/bin/env php $c/phpunit.stdout 2> $c/phpunit.stderr", array(), $pipes)) { + if ($proc = proc_open(sprintf($cmd, $c, " > $c/phpunit.stdout 2> $c/phpunit.stderr"), array(), $pipes)) { $runningProcs[$component] = $proc; } else { $exit = 1; @@ -137,7 +142,7 @@ if (isset($argv[1]) && 'symfony' === $argv[1]) { // Run regular phpunit in a subprocess $errFile = tempnam(sys_get_temp_dir(), 'phpunit.stderr.'); - if ($proc = proc_open(sprintf($cmd, '').' 2> '.escapeshellarg($errFile), array(1 => array('pipe', 'w')), $pipes)) { + if ($proc = proc_open(sprintf($cmd, '', ' 2> '.ProcessUtils::escapeArgument($errFile)), array(1 => array('pipe', 'w')), $pipes)) { stream_copy_to_stream($pipes[1], STDOUT); fclose($pipes[1]); $exit = proc_close($proc); diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php index 04f2237be2..ae32fe6bb4 100644 --- a/src/Symfony/Component/Yaml/Parser.php +++ b/src/Symfony/Component/Yaml/Parser.php @@ -375,17 +375,9 @@ class Parser $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem($this->currentLine); - // Comments must not be removed inside a block scalar - $removeCommentsPattern = '~'.self::BLOCK_SCALAR_HEADER_PATTERN.'$~'; - $removeComments = !preg_match($removeCommentsPattern, $this->currentLine); - while ($this->moveToNextLine()) { $indent = $this->getCurrentLineIndentation(); - if ($indent === $newIndent) { - $removeComments = !preg_match($removeCommentsPattern, $this->currentLine); - } - if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine) && $newIndent === $indent) { $this->moveToPreviousLine(); break; @@ -396,10 +388,6 @@ class Parser continue; } - if ($removeComments && $this->isCurrentLineComment()) { - continue; - } - if ($indent >= $newIndent) { $data[] = substr($this->currentLine, $newIndent); } elseif (0 == $indent) { diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php index 08ef43faa5..792bcf9501 100644 --- a/src/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php @@ -679,6 +679,43 @@ EOF )); } + public function testSecondLevelFoldedStringBlockWithComments() + { + $this->assertEquals(array( + 'pages' => array( + array( + 'title' => 'some title', + 'content' => << +

title

+ + +footer # comment3 +EOT + ), + ), + ), Yaml::parse(<< +

title

+ + + footer # comment3 +EOF + )); + } + public function testNestedFoldedStringBlockWithComments() { $this->assertEquals(array(array(