Skip to content
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

Locale Files are Generated with Windows Line-endings #2172

Closed
oleibman opened this issue Jun 18, 2021 · 4 comments
Closed

Locale Files are Generated with Windows Line-endings #2172

oleibman opened this issue Jun 18, 2021 · 4 comments

Comments

@oleibman
Copy link
Collaborator

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

Files should have Unix line endings.

What is the current behavior?

They have Windows line endings. This causes git to think they have all been changed; at least that's what it thinks on my Windows machine (which I have configured to use Unix line endings). It would be easy enough to change them all, but, since they appear to be generated, I'm not sure any such change would stick.

What are the steps to reproduce?

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

Which versions of PhpSpreadsheet and PHP are affected?

This seems to have been caused by #2111.

@oleibman
Copy link
Collaborator Author

As a workaround, I can run bin/generate-locales under Cygwin. This changes the (line endings in) the locale files, but git no longer thinks they have been changed. It's weird, but it works.
My guess is that "\n" rather than PHP_EOL in infra/LocaleGenerator.php will probably figure into the solution, if any is required.

@oleibman
Copy link
Collaborator Author

Aha, it all starts to make sense now. There is a locale generator test which runs as part of the test suite, and that's what's causing the files to appear changed. I think I now know the fix, and will start working on it.

oleibman added a commit to oleibman/PhpSpreadsheet that referenced this issue Jun 19, 2021
See issue PHPOffice#2172. The locale files are regenerated whenever the test suite is run.

The use of PHP_EOL in LocaleGenerator.php is awkward on Windows systems, since it causes git to think the file has changed. Change to use `"\n"` instead.
@MarkBaker
Copy link
Member

I'm glad you figured it out.... I test locally against different PHP versions on Windows while I'm working, but I always run the tests on a Linux VM before my commit

MarkBaker pushed a commit that referenced this issue Jun 19, 2021
…2174)

See issue #2172. The locale files are regenerated whenever the test suite is run.

The use of PHP_EOL in LocaleGenerator.php is awkward on Windows systems, since it causes git to think the file has changed. Change to use `"\n"` instead.
@oleibman
Copy link
Collaborator Author

Solved by #2174.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants