Skip to content

[TwigComponent] Fix directory separator in Debug command #2342

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 3 commits into from
Nov 7, 2024

Conversation

clussiana
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
Issues
License MIT

Component template paths are retrieved by the SplFileInfo class, which returns paths containing backslashes on Windows and slashes on other operating systems.

So on Windows environment, the command fails as the component Card\Card.html.twig is not formatted into Card:Card

@carsonbot carsonbot added Bug Bug Fix Status: Needs Review Needs to be reviewed labels Nov 5, 2024
@clussiana clussiana changed the title fix: replace / by DIRECTORY_SEPARATOR [TwigComponent] replace / by DIRECTORY_SEPARATOR Nov 5, 2024
@clussiana
Copy link
Contributor Author

@smnandre I've submitted the fix in this PR, but I haven’t included a test because I’m not quite sure how to mock or simulate DIRECTORY_SEPARATOR effectively. If you have any advice or suggestions on setting up this test, I’d really appreciate it!

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Nov 5, 2024
@Kocal
Copy link
Member

Kocal commented Nov 5, 2024

Thanks for your PR, I don't think you have something to do here, but ideally we should enable Windows builds on the CI

@smnandre smnandre changed the title [TwigComponent] replace / by DIRECTORY_SEPARATOR [TwigComponent] Fix directory separator in Debug command Nov 7, 2024
@smnandre
Copy link
Member

smnandre commented Nov 7, 2024

Thanks @clussiana.

@smnandre smnandre merged commit 8215922 into symfony:2.x Nov 7, 2024
59 checks passed
@clussiana clussiana deleted the component-directory-separator branch November 7, 2024 20:34
@xDeSwa
Copy link
Contributor

xDeSwa commented Nov 20, 2024

thanks, this fixed
Unknown component "Stream\After". And no matching anonymous component template was found.
error on windows.

aa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants