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

YAMLDump: Strings don't get quoted properly #53

Open
lukasbestle opened this issue Jul 16, 2016 · 0 comments
Open

YAMLDump: Strings don't get quoted properly #53

lukasbestle opened this issue Jul 16, 2016 · 0 comments

Comments

@lukasbestle
Copy link

lukasbestle commented Jul 16, 2016

Test case:

$data = [
    [
        'name' => 'Lorem ipsum',
        'quote' => 'Dolor sit amet.'
    ],
    [
        'name' => 'Consetetur sadipscing',
        'quote' => '"Elitr sed diam nonumy eirmod."'
    ]
];

echo Spyc::YAMLDump($data);

Also see getkirby-v2/panel#892 (comment).

Expected behavior:

The second entry is quoted by Spyc so that the quotes around the string get preserved:

- 
  name: Lorem ipsum
  quote: Dolor sit amet.
- 
  name: Consetetur sadipscing
  quote: '"Elitr sed diam nonumy eirmod."'

Actual behavior:

The string is used as-is without quoting:

- 
  name: Lorem ipsum
  quote: Dolor sit amet.
- 
  name: Consetetur sadipscing
  quote: "Elitr sed diam nonumy eirmod."

When parsing that YAML string again, the quotes are removed.

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

1 participant