8000 Symfony yaml pattern with double quotes · Issue #24408 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Symfony yaml pattern with double quotes #24408

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
faheemhameed opened this issue Oct 3, 2017 · 5 comments
Closed

Symfony yaml pattern with double quotes #24408

faheemhameed opened this issue Oct 3, 2017 · 5 comments

Comments

@faheemhameed
Copy link
faheemhameed commented Oct 3, 2017
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 3.3.9
            pattern: 
                "^/api/(apiName1|\
                apiName2|\
                apiName3)"

The above pattern supposed to be translated as

{ pattern: '^/api/(apiName1|apiName2|apiName3)' }

http://nodeca.github.io/js-yaml/

But it's translated with a space for line break as below:

{ pattern: '^/api/(apiName1| apiName2| apiName3)' }

It seems to me like a bug.

Thanks.

@xabbuh
Copy link
Member
xabbuh commented Oct 3, 2017

I don't understand. Why should spaces inside a quoted string be ignored? (I have updated your issue description to make clear that we are talking about multi-line strings)

@xabbuh
Copy link
Member
xabbuh commented Oct 3, 2017

I am going to close here as the observed behaviour is correct. In (double) quoted strings newlines are folded which means that the become a space (see http://www.yaml.org/spec/1.2/spec.html#id2760844).

@xabbuh xabbuh closed this as completed Oct 3, 2017
@faheemhameed
Copy link
Author

Sorry, I missed to add the backslash at the end of the line in the pattern.

I understand that the each new line is converted to a single space but when you add a backslash at the end of the line then it strips that white space.

`yaml
pattern:
"^/api/(apiName1|
apiName2|
apiName3)"
``

Please try to see this here:

http://nodeca.github.io/js-yaml/#yaml=ICAgICAgICAgICAgcGF0dGVybjogCiAgICAgICAgICAgICAgICAiXi9hcGkvKGFwaU5hbWUxfFwKICAgICAgICAgICAgICAgIGFwaU5hbWUyfFwKICAgICAgICAgICAgICAgIGFwaU5hbWUzKSI=

But if I am wrong you may please help let me know how to achieve the above (spaceless translation of new line characters)

@xabbuh
Copy link
Member
xabbuh commented Oct 3, 2017

@faheemhameed I have updated your description to reflect the backslashes. And you are right, for that example you would indeed expect the outcome that you describe.

@xabbuh
Copy link
Member
xabbuh commented Oct 3, 2017

see #24416

fabpot added a commit that referenced this issue Oct 5, 2017
…abbuh)

This PR was merged into the 3.3 branch.

Discussion
----------

[Yaml] treat trailing backslashes in multi-line strings

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

Commits
-------

80af9b8 treat trailing backslashes in multi-line strings
@fabpot fabpot closed this as completed Oct 5, 2017
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

4 participants
0