Skip to content

[FrameworkBundle][Template name] fixed "the template format is invalid." #12254

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 1 commit into from

Conversation

aitboudad
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets #12249
Tests pass? yes
License MIT

@soullivaneuh
Copy link
Contributor

👍 for this PR! :)

Will this be available on 2.6 version?

@fabpot
Copy link
Member

fabpot commented Nov 12, 2014

This looks good to me but I have some questions:

  • the error message for the shortcut notation has been removed and so, the behavior is different than before. Basically, we cannot validate the format anymore as it can be several things.
  • because the error message is different, do we merge this one in 2.3? If not, it can be in 2.6 but then, this is a problem when trying to apply the best practices in an "older" project.

ping @weaverryan @javiereguiluz

@soullivaneuh
Copy link
Contributor

If best practices should be able to apply on >=2.3, so yes, I think this bug fix would be merge on 2.3 and 2.6.

@javiereguiluz
Copy link
Member

@fabpot I agree that this should be backported to 2.3 because old projects use best practices too.

@weaverryan
Copy link
Member

Hey guys!

I did some digging around, because the flow here is quite complex (there are several layers of try-catch).

Basically, we need to not throw an exception from TemplateNameParser, because it causes the true exception to be "covered up" (e.g. The file "foo/bar2.html.twig" does not exist (in: /path/to/project/app/Resources)). So I like the solution (I tried it out locally).

As far as the behavior changing, it really doesn't. We're no longer throwing an exception from TemplateNameParser. But this only causes the $previous variable here to be the more clear InvalidArgumentException (message listed above) instead of the InvalidArgumentException that was replaced.

So unless you're using the TemplateNameParser directly, there is no behavior change (just a different exception message). If avoided merging this into 2.3, it would be because of that. If that is a problem, we could create a slightly more elaborate patch for 2.3 that would fully protect BC.

Regardless, I think getting this into 2.3 is important - the error message is much much better after this patch.

Cheers!

@aitboudad
Copy link
Contributor Author

closed in favor of #12894 ( +2.3 ).

@aitboudad aitboudad closed this Dec 8, 2014
fabpot added a commit that referenced this pull request Dec 8, 2014
…he shortcut n... (aitboudad)

This PR was merged into the 2.3 branch.

Discussion
----------

[FrameworkBundle][Template name] avoid  error message for the shortcut n...

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Fixed tickets  | #12249,  #12254
| Tests pass?   | yes
| License       | MIT

Commits
-------

055129c [FrameworkBundle][Template name] avoid  error message for the shortcut notation.
@aitboudad aitboudad deleted the ticket_12249 branch December 8, 2014 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants