Skip to content

Commit 3ed802c

Browse files
Merge branch '5.3' into 5.4
* 5.3: Fix Choice constraint with associative choices array [Form] UrlType should not add protocol to emails Silence isatty warnings during tty detection [Serializer] Fix AbstractObjectNormalizer not considering pseudo type false [Notifier] Fix encoding of messages with FreeMobileTransport [Cache] workaround PHP crash [Console] Fix PHP 8.1 deprecation in ChoiceQuestion [Notifier] smsapi-notifier - correct encoding Replaced full CoC text with link to documentation Making the parser stateless [Console] fix restoring stty mode on CTRL+C fix merge (bis) fix merge [Process] Avoid calling fclose on an already closed resource [GHA] test tty group [DI] Fix tests on PHP 7.1
2 parents 37bcbbb + c441e9d commit 3ed802c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Parser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ public function parse(string $value, int $flags = 0)
9999
if (null !== $mbEncoding) {
100100
mb_internal_encoding($mbEncoding);
101101
}
102+
$this->refsBeingParsed = [];
103+
$this->offset = 0;
102104
$this->lines = [];
103105
$this->currentLine = '';
104106
$this->numberOfParsedLines = 0;

Tests/ParserTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,20 @@ public function invalidIndentation(): array
8484
];
8585
}
8686

87+
public function testParserIsStateless()
88+
{
89+
$yamlString = '# translations/messages.en.yaml
90+
91+
';
92+
$this->parser->parse($yamlString);
93+
$this->parser->parse($yamlString);
94+
95+
$this->expectException(ParseException::class);
96+
$this->expectExceptionMessage("A YAML file cannot contain tabs as indentation at line 2 (near \"\tabc\")");
97+
98+
$this->parser->parse("abc:\n\tabc");
99+
}
100+
87101
/**
88102
* @dataProvider validTokenSeparators
89103
*/

0 commit comments

Comments
 (0)