Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML::Tiny loads things it should error on #35

Open
ingydotnet opened this issue Jun 8, 2015 · 2 comments
Open

YAML::Tiny loads things it should error on #35

ingydotnet opened this issue Jun 8, 2015 · 2 comments

Comments

@ingydotnet
Copy link
Contributor

This YAML:

- *foo
- [foo]
- {foo}
- {xxx: yyy}
- ? foo

Loads as:

$VAR1 = [
  '*foo',
  '[foo]',
  '{foo}',
  {
    '{xxx' => 'yyy}'
  },
  '? foo'
];

These are all valid YAML things, but YAML::Tiny loads them as scalars. Instead
it should throw an error, since they are things that YAML::Tiny doesn't support
by design.

@perlpunk
Copy link

perlpunk commented Mar 10, 2020

I have a more complete list. These should all be invalid:

!foo: bar
&foo: bar
*foo: bar
,foo: bar
[foo: bar
]foo: bar
{foo: bar
}foo: bar
|foo: bar
>foo: bar
? foo: bar
@foo: bar
`foo: bar

The problem is, if people are using these things in YAML and read it with YAML::Tiny, it will load it, and then it will be incompatible with other modules in perl and other languages.
So I agree with @ingydotnet : while I see that YAML::Tiny just implements a subset, it should at least die in these cases.

@perlpunk
Copy link

Also:

- *foo
- ,foo
- [foo]
- ]foo
- {foo: bar}
- }foo
- ? foo

loads as (JSON):

[
  "*foo",
  ",foo",
  "[foo]",
  "]foo",
  {
    "{foo": "bar}"
  },
  "}foo",
  "? foo"
]

While some of that should be invalid and some should be loaded differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants