zendframework / zend-code

BSD 3-Clause "New" or "Revised" License
1.68k stars 78 forks source link

"newLine" Bug in MethodGenerator class #111

Open finalJustize opened 7 years ago

finalJustize commented 7 years ago

The static function {{Zend\Code\Generator\MethodGenerator::clearBodyIndention}} fails on Windows 10, php 7.1. in line 83: $lines = explode(PHP_EOL, $body); $body does not contain any PHP_EOL (\n\r) characters, no matter what line ending encoding the source content had before. works well on Linux, OSX.

quick fix: change line 83 to $lines = explode("\n", $body);

Ocramius commented 7 years ago

Urgh, this is super-annoying :-(

We need to split via "\n" and also "\r\n" or whatever other exotic platforms (windows/unix) support.

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On Wed, Jun 28, 2017 at 10:39 AM, finalJustize notifications@github.com wrote:

The static function {{Zend\Code\Generator\MethodGenerator::clearBodyIndention}} fails on Windows 10, php 7.1. in line 83: $lines = explode(PHP_EOL, $body); $body does not contain any PHP_EOL (\n\r) characters, no matter what line ending encoding the source content had before. works well on Linux, OSX.

quick fix: change line 83 to $lines = explode("\n", $body);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/zendframework/zend-code/issues/111, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakIRuh0bQh_aTCqpLrq9-K0Pw5hFWks5sIhFXgaJpZM4OHqLr .

weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-code; a new issue has been opened at https://github.com/laminas/laminas-code/issues/13.