Skip to content

Commit 420de14

Browse files
Merge branch '2.8' into 3.2
* 2.8: fix risky tests [Yaml] release memory after parsing [HttpFoundation] Fix and test status codes according to IANA's data Add `use_strict_mode` in validOptions for session [Console] Inherit phpdoc from OutputFormatterInterface
2 parents fc84720 + 7f7cac7 commit 420de14

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

Parser.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public function parse($value, $flags = 0)
109109
mb_internal_encoding($mbEncoding);
110110
}
111111

112+
$this->lines = array();
113+
$this->currentLine = '';
114+
$this->refs = array();
115+
$this->skippedLineNumbers = array();
116+
$this->locallySkippedLineNumbers = array();
117+
112118
if (null !== $e) {
113119
throw $e;
114120
}

Tests/InlineTest.php

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,24 +277,39 @@ public function testParseUnquotedAsteriskFollowedByAComment()
277277
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
278278
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
279279
*/
280-
public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
280+
public function testParseUnquotedScalarStartingWithReservedAtIndicator()
281281
{
282-
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
282+
Inline::parse('{ foo: @foo }');
283283
}
284284

285-
public function getReservedIndicators()
285+
/**
286+
* @group legacy
287+
* @expectedDeprecation Not quoting the scalar "`foo " starting with "`" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
288+
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
289+
*/
290+
public function testParseUnquotedScalarStartingWithReservedBacktickIndicator()
291+
{
292+
Inline::parse('{ foo: `foo }');
293+
}
294+
295+
/**
296+
* @group legacy
297+
* @expectedDeprecation Not quoting the scalar "|foo " starting with "|" is deprecated since Symfony 2.8 and will throw a ParseException in 3.0.
298+
* throws \Symfony\Component\Yaml\Exception\ParseException in 3.0
299+
*/
300+
public function testParseUnquotedScalarStartingWithLiteralStyleIndicator()
286301
{
287-
return array(array('@'), array('`'));
302+
Inline::parse('{ foo: |foo }');
288303
}
289304

290305
/**
291306
* @dataProvider getScalarIndicators
292307
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
293308
* @expectedExceptionMessage cannot start a plain scalar; you need to quote the scalar.
294309
*/
295-
public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
310+
public function testParseUnquotedScalarStartingWithFoldedStyleIndicator()
296311
{
297-
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
312+
Inline::parse('{ foo: >foo }');
298313
}
299314

300315
public function getScalarIndicators()

0 commit comments

Comments
 (0)