Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[2.2] [Routing] add escaping syntax for placeholders #4563

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
wants to merge 2 commits into from

Conversation

Tobion
Copy link
Contributor

@Tobion Tobion commented Jun 12, 2012

Test pass: yes
Feature addition: yes
BC break: only if somebody used a route like /\{var} that is now used as escaping syntax

You can now have {foo} inside a route as static text instead of beeing considered as variable. This can be achieved by escaping it with "" as suggested by @Seldaek, e.g. \{foo}. This is consistent as other languages use "" as escaping char too, e.g. PHP itself and PCRE regular expressions.

@travisbot
Copy link

This pull request passes (merged 945ad8a0 into 37550d2).

fabpot added a commit that referenced this pull request Oct 3, 2012
This PR was merged into the master branch.

Commits
-------

005a9a3 [Routing] fixed RouteCompiler for adjacent and nested placeholders

Discussion
----------

[2.2] [Routing] fixed RouteCompiler for adjacent placeholders

Tests pass: yes
Feature addition: no
Fixes: #4215
BC break: no

- Nesting placeholders works now properly, e.g. `/{foo{bar}}`. Only `bar` is a variable, the rest is static text.
- Variables without separator work now correctly too, e.g. `/{w}{x}{y}{z}.{_format}`. All variables will have the correct default regex in the current manner, that is exclude the previous static char and the next static char (which means disregarding the placeholder in between that have no seperator).

As you can see, I have not modified any tests, only added some. So this change is BC. The compiler now works under all conditions and does not fail for such patterns.

---------------------------------------------------------------------------

by Tobion at 2012-05-08T22:34:58Z

ready for review / merging
Thanks @snc for giving a helpful tip.

---------------------------------------------------------------------------

by Tobion at 2012-06-12T23:22:54Z

fabpot told me, he doesn't like PRs that both fix and enhance stuff. So I reworked this PR so that it only contains the bug fixes.
The new PR #4563 contains the feature addition.

---------------------------------------------------------------------------

by Tobion at 2012-06-26T12:33:43Z

ping @fabpot

---------------------------------------------------------------------------

by Tobion at 2012-08-14T16:29:27Z

Why wait for 2.2? It's a bugfix only, without BC break.

---------------------------------------------------------------------------

by Tobion at 2012-08-31T17:04:37Z

@fabpot I think this should go into 2.1
@stof
Copy link
Member

stof commented Oct 13, 2012

@fabpot @Tobion what is the status of this PR ?

@Tobion
Copy link
Contributor Author

Tobion commented Oct 13, 2012

It's ready.

@fabpot
Copy link
Member

fabpot commented Oct 27, 2012

I'm -1 for this PR. It complexifies the code for a situation that never occurs.

@Tobion
Copy link
Contributor Author

Tobion commented Oct 27, 2012

It's true that it basically never occurs. But if #5424 gets implemented, we probably need some way of escaping. Otherwise () could also not be used in a route. So sooner or later we might need it.

@Tobion
Copy link
Contributor Author

Tobion commented Feb 12, 2013

Closing because it will be covered by #7051.

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

Successfully merging this pull request may close these issues.

4 participants