Skip to content

[Yaml][Parser] Mapping misdetected in quote #16562

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

Closed
GwendolenLynch opened this issue Nov 16, 2015 · 3 comments
Closed

[Yaml][Parser] Mapping misdetected in quote #16562

GwendolenLynch opened this issue Nov 16, 2015 · 3 comments

Comments

@GwendolenLynch
Copy link
Contributor

Version: symfony/yaml v2.8.0-BETA1

The following snippet of YAML is causing the parser to misdetect the comment # Note: as a mapping.

showcases:
    fields:
        image:
            type: image
            attrib: title # Note: retrieve this in your template with {{ record.values.image.title }}
            extensions: [ gif, jpg, png ]

The error thrown in PHPUnit is:

Using a colon in an unquoted mapping value in line 133 is deprecated since Symfony 2.8 and will throw a ParseException in 3.0:

Changing the attrib: line above to below suppresses the deprecation warning

attrib: title # 'Note:' retrieve this in your template with {{ record.values.image.title }}
@SoboLAN
Copy link

SoboLAN commented Nov 28, 2015

I just tried your issue and I can successfully reproduce it on 2.8.0-BETA1.

It works fine in 2.6.12 and in 2.7.7.

Seems to be introduced in 8416f7ba519fa3bbd8c1ffc0000c1a7c5730efba.

@xabbuh
Copy link
Member

xabbuh commented Nov 29, 2015

Status: Reviewed

see #16745

fabpot added a commit that referenced this issue Nov 29, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

[Yaml] look for colon in parsed inline string

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #16562
| License       | MIT
| Doc PR        |

Looking for a colon in an unquoted mapping value can lead to falsely
reported parse errors (e.g. when a comment after the mapping value
contains a colon).

Commits
-------

2127058 [Yaml] look for colon in parsed inline string
@fabpot fabpot closed this as completed Nov 29, 2015
@crmpicco
Copy link

This is a particularly difficult thing to search your Yaml files for. 😧

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

No branches or pull requests

6 participants