-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[3.0.2][BUG][Templating] Regression introduced in TemplateNameParser #17683
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
Comments
@francoispluchino what kind of a template path are you talking about exactly?
|
Yes the path is correctly converted by $name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', str_replace('\\', '/', $name))); But with the new regex if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) { the result of match is true and not false (normally). This gives a TemplateReference with a bundle name It is not the case with the old pattern. |
What I was saying earlier is that both regular expressions work the same with the example path I gave (both don't match |
It's not the case with:
|
That's what I was after (an example). What's the outcome you expect? |
preg_match result: matches result: [] not: [
"C:path/to/section/name.html.twig",
"C",
"",
"path/to/section/name",
"html",
"twig"
] The problem is with the file names with many dot. |
see also #17777 which contains some more information how to reproduce this issue |
@francoispluchino any idea why the name is normalised to |
No I haven't idea, but the bug is caused by the name with more dot, not by the drive (ex. |
@francoispluchino I know that, just trying to understand why it's normalised to this form :) Thanks anyway! |
@fabpot Why the
@jakzal I think it is better to focus on the end of the regex pattern, which blocks the use of file names with more dots. |
Template names starting with "@" are also broken (see ticket #17958). Are they also considered absolute paths, or should I reopen the other ticket? |
@hcomnetworkers they're not considered absolute paths, but I'm fixing them as part of #17894 (that's why it's not merged yet). |
…mplate paths (jakzal) This PR was merged into the 2.3 branch. Discussion ---------- [FrameworkBundle] Fix a regression in handling absolute template paths | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17777 #17683 | License | MIT | Doc PR | - Regression introduced by #15272. Commits ------- d8c493f [FrameworkBundle] Fix a regression in handling absolute and namespaced template paths
With the commit 4003532, The new regex pattern at the line 59 in
Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser::parse
confuses the letter of the Windows driveC:\
with a name of bundle.This bug is only on Windows Platform with Symfony version:
3.0.2
,3.0.x-dev
,2.8.x-dev, >2.8.2
The text was updated successfully, but these errors were encountered: