-
Notifications
You must be signed in to change notification settings - Fork 188
Mapping pass doesn't work with DOS line endings in PHP files. #899
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
Thank you! I had many files with wrong line endings. Not sure if I should submit a PR but they should have something like this: vendor\ongr\elasticsearch-bundle\DependencyInjection\Compiler\MappingPass.php: line 152
to normalize both types of line endings so regex works. For some reason PHP regex recognizes this In addition I had to only specify the folder I put my mapping files in so it doesn't scan the whole
After those two tweaks I was finally able to get 6.x to work. I was stuck on 5.x for the longest time due to this, so thanks! |
Well, I never have seen that any of the libraries (like doctrine, symfony etc) would check the line endings since it is the kind of responsibility of the user. |
Also, files read doctrine cache reader component and not this library, so technically if you guys want to support file endings the issue should be opened in the doctrine ;) |
Why not just remove the $ from the preg_match on line 160 and it should work no matter the line endings as you're not matching to end of line, only to the colon, so the $ is redundant.
The real issue here is when you are working on your project in Windows and use Git to checkout to a linux dev server, Git will change the file endings to /r/n as you're checking it out on Windows, then you commit and push, it changes them back to /n, but while you're developing PHP is expecting the standard linux EOL. |
I'll double-check if the removal of |
The mapping pass failes at the namespace generation point when you have DOS line endings in the PHP files.
For instance
^ "App\Security\Authenticator"
^ "/var/www/html/src"
^ "\OtherAuthenticator"
^ "/var/www/html/src"
Where Authenticator had Linux line endings (/n) and OtherAuthenticator in the same namespace as Authenticator had DOS line endings (/r/n)
The text was updated successfully, but these errors were encountered: