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

Skip to content

[FrameworkBundle] Fix invalid Windows path normalization in TemplateNameParser #34915

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

Merged
merged 1 commit into from
Dec 15, 2019
Merged

[FrameworkBundle] Fix invalid Windows path normalization in TemplateNameParser #34915

merged 1 commit into from
Dec 15, 2019

Conversation

mvorisek
Copy link
Contributor

Q A
Branch? 3.4 - <5.0
Bug fix? yes
New feature? no
Deprecations? no
Tickets no
License MIT
Doc PR Fix invalid Windows path normalization

All versions of Symfony until 5.0 (which does no longer do extra file path normalization) normalize Windows paths wrongly.

See PrestaShop/PrestaShop#16736 and https://bugs.php.net/bug.php?id=78939

Currently this issue can be observed when Symfony is run by NTS PHP only, but once the PHP issue will be fixed, this issue will probably affects all Windows users when absolute template name is passed to Symfony templating.

@nicolas-grekas
Copy link
Member

Could you please add a test case?

@mvorisek
Copy link
Contributor Author

I just updated the existing tests.

Absolute path support has been removed in Symfony 4.0, so this PR should be:

  • fully merged in all maintained 3.x branches (i.e. 3.4)
  • and only the file src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php should be merged to 4.x branches (to remove the issue residue, but the tests are no longer relevant for 4.x versions)
  • in 5.x/develop branches there is no such code (not even under different file name)

@OskarStark
Copy link
Contributor

Could this class help in this case?

#30969

@mvorisek
Copy link
Contributor Author

@OskarStark

Could this class help in this case?
#30969

No, the mentioned PR does not update the destructive change done at this line https://github.com/symfony/symfony/pull/34915/files#diff-b696dd35180a8539992b7a209a0c9defL47 in any way.

@mvorisek
Copy link
Contributor Author

@nicolas-grekas Tests updated, see above, can you please review and merge?

@nicolas-grekas nicolas-grekas changed the title Fix invalid Windows path normalization [FrameworkBundle] Fix invalid Windows path normalization in TemplateNameParser Dec 13, 2019
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This str_replace() dates back to 22aba90 but I fail to see why it's here now.
The changes on the tests LGTM.

@fabpot
Copy link
Member

fabpot commented Dec 15, 2019

Thank you @mvorisek.

fabpot added a commit that referenced this pull request Dec 15, 2019
…n TemplateNameParser (mvorisek)

This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Fix invalid Windows path normalization in TemplateNameParser

| Q             | A
| ------------- | ---
| Branch?       | 3.4 - <5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | no
| License       | MIT
| Doc PR        | Fix invalid Windows path normalization

All versions of Symfony until 5.0 (which does no longer do extra file path normalization) normalize Windows paths wrongly.

See PrestaShop/PrestaShop#16736 and https://bugs.php.net/bug.php?id=78939

Currently this issue can be observed when Symfony is run by NTS PHP only, but once the PHP issue will be fixed, this issue will probably affects all Windows users when absolute template name is passed to Symfony templating.

Commits
-------

130df8c Fix invalid Windows path normalization
@fabpot fabpot merged commit 130df8c into symfony:3.4 Dec 15, 2019
@mvorisek mvorisek deleted the fix_php_windows_relative_path branch December 15, 2019 17:17
This was referenced Dec 19, 2019
@mvorisek mvorisek restored the fix_php_windows_relative_path branch December 26, 2019 12:16
@mvorisek
Copy link
Contributor Author

Will this PR be merged into 3.4 and develop branch as well and when is the next 3.4 release planned?

Is it ok to delete the fork before the PR is merged in all branches?

@OskarStark
Copy link
Contributor

it’s fine to delete the fork as it’s already merged in 3.4 upstream branch

@mvorisek mvorisek deleted the fix_php_windows_relative_path branch December 26, 2019 16:13
This was referenced Jan 21, 2020
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