zend-code icon indicating copy to clipboard operation
zend-code copied to clipboard

"newLine" Bug in MethodGenerator class

Open finalJustize opened this issue 8 years ago • 2 comments

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);

finalJustize avatar Jun 28 '17 08:06 finalJustize

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 [email protected] 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 .

Ocramius avatar Jun 29 '17 12:06 Ocramius

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.

weierophinney avatar Dec 31 '19 21:12 weierophinney