Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Conversation

mikeSimonson
Copy link
Contributor

Uniformazing the line ending in the project to avoid issue
with windows.

Fix #45 and Fix #39

Uniformazing the line ending in the project to avoid issue with windows. Fix zendframework#45 and Fix zendframework#39
@krzysiekpiasecki
Copy link

IMHO we should always outputting with \PHP_EOL.

@mikeSimonson
Copy link
Contributor Author

The problem is that you can only reliably split on "\n" and if you sometimes output code using PHP_EOL then you will leave some "\r" randomly in the output on windows. I don't know if it could cause issue though.

@mikeSimonson
Copy link
Contributor Author

@Ocramius
Copy link
Member

Ocramius commented Apr 2, 2016

IMHO we should always outputting with \PHP_EOL.

The fact that this generates different code on windows and on proper operating systems (:trollface:) is already a show-stopper for using \PHP_EOL.

I think the fix is legit, but we need to check if the tests need some changes too. @mikeSimonson did you check if these modified paths are covered by tests that expect "\n" or \PHP_EOL?

@krzysiekpiasecki
Copy link

The fact that this generates different code on windows and on proper operating systems (:trollface:) is already a show-stopper for using \PHP_EOL.

This is the general idea. For example: Outputting to the files according to operation system sounds reasonable. When collaborating with files we have 'converters' etc. or maybe the better is using one proper operating system :)

This fix prevent us from bug observed on Windows machines during composer install when dealing with win files.

- $lines = explode(PHP_EOL, $body); + $lines = explode("\n", $body);

Nothing more is need it to fix this bug. Even tests are not necessary ;)

@Ocramius
Copy link
Member

Ocramius commented Apr 2, 2016

Outputting to the files according to operation system sound reasonable.

No, ZF in general has a "no dependency on configuration/environment", nor "modification of environment" policy.

The components should behave in the same way regardless of the OS. Generated code is considered an output.

@mikeSimonson
Copy link
Contributor Author

@Ocramius Do I need to change anything ?

@Ocramius
Copy link
Member

@mikeSimonson I'd need you to just check whether any tests are still relying on PHP_EOL. They should all verify only \n line-endings.

@Ocramius Ocramius added the bug label Apr 19, 2016
@Ocramius Ocramius added this to the 3.0.2 milestone Apr 19, 2016
@Ocramius Ocramius self-assigned this Apr 19, 2016
@mikeSimonson
Copy link
Contributor Author

mikeSimonson commented Apr 19, 2016

@Ocramius I think its fixed. There is only one reference left to PHP_EOL in this file. The test pass if it's uncommented and converted to \n. Should I add that too ?

The failure is only related to an update of phpcs. I am looking into the rule that need to be set to remove the failures.

@Ocramius
Copy link
Member

@mikeSimonson thanks

@Ocramius Ocramius assigned weierophinney and unassigned Ocramius Apr 20, 2016
@weierophinney weierophinney merged commit 9d1f325 into zendframework:master Apr 20, 2016
weierophinney added a commit that referenced this pull request Apr 20, 2016
Trying to fix a platform issue with windows line ending
weierophinney added a commit that referenced this pull request Apr 20, 2016
weierophinney added a commit that referenced this pull request Apr 20, 2016
weierophinney added a commit that referenced this pull request Apr 20, 2016
@mikeSimonson
Copy link
Contributor Author

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4 participants