-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Description
Symfony version(s) affected
7.4.0 (arguably earlier as well)
Description
When failing to parse a YAML file, the line number is incorrect - and changed in 7.4.0.
How to reproduce
Have invalid YAML, for example:
en:
NONAMESPACE: Include Entity without Namespace
Invalid: Foo
About: 'About us'
- Invalid
Parse with the following code:
use Symfony\Component\Yaml\Parser;
$path = 'path/to/the/file.yaml';
$parser = new Parser();
$parser->parse(file_get_contents($path));Note the line should probably be "4" for the above (i.e. the line where the offending colon lives), but for 7.3.5 it reported as line "5" and as of 7.4.0 it reports as line "6".
Note also that if you remove the empty line at the bottom of the file, it reports as line "5" again - but the empty line at the end of the file shouldn't affect which line the error is reported for.
Possible Solution
No response
Additional Context
No response