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

Split lines on "\n" rather than PHP_EOL. Fixes compatibility issues with Windows. #7

Merged
merged 1 commit into from
Nov 7, 2011

Conversation

wnielson
Copy link
Contributor

@wnielson wnielson commented Nov 7, 2011

No description provided.

@avalanche123
Copy link
Owner

Have an example file i could test with, maybe the solution is first to replace all occurrences of PHP_EOL with "\n"?

@wnielson
Copy link
Contributor Author

wnielson commented Nov 7, 2011

Try this Gist: https://gist.github.com/1345477 (the text is raw to preserve the newlines).

On Windows with PHP_EOL, the output I get is:

[{"tags":[],"description":"","isPrivate":false,"isProtected":false,"isPublic":true,"isAbstract":false,"isFinal":false,"isStatic":false,"code":"function sayHello($name)","type":"function","name":"sayHe
llo()"}]

Changing PHP_EOL to "\n", I get:

[{"tags":[{"type":"param","types":["string"],"name":"name","description":"A name to say hello to"}],"description":"A simple function to print \"hello\"\r\n\r","isPrivate":false,"isProtected":false,"is
Public":true,"isAbstract":false,"isFinal":false,"isStatic":false,"code":"function sayHello($name)","type":"function","name":"sayHello()"}]

I get the second output on Linux and OS X regardless of whether PHP_EOL is used or "\n".

I'm not sure replacing PHP_EOL with "\n" is necessary because you later use trim($line) to remove any extra cruft from the line anyway, but I suppose it probably wouldn't hurt.

@avalanche123
Copy link
Owner

I'm convinced, thanks

avalanche123 added a commit that referenced this pull request Nov 7, 2011
Split lines on "\n" rather than PHP_EOL.  Fixes compatibility issues with Windows.
@avalanche123 avalanche123 merged commit 3b3a197 into avalanche123:master Nov 7, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants