Issues

ZF-6544: duplicated new lines characters when calling Zend_Reflection_Method::getBody()

Description

When I run zf.sh to add a new action to an existing controller, I saw it added extra new line characters to my existing methods. Trying to figure out how to solve it, I saw the cause was in Zend_Reflection_Method::getBody().

Making a call to file(), returns a array with a line (included "\n") for each index. So, in the getBody() return statment, the implode ("\n", $lines) adds an extra "\n" character. I solve it in local replacing: file($this->getDeclaringClass()->getFileName())

for file($this->getDeclaringClass()->getFileName(), FILE_IGNORE_NEW_LINES)

Now it works fine for me.

I'm running zf 1.8.0 and Zend Core under Kubuntu 9.04

Comments

Assigning to Ralph to triage.

Can you please fix this? I am just starting to use Zend Framework (1.9.1) and ran into this issue (on Mac OS X 10.4.11 Intel with PHP 5.3.0). It seems straightforward enough to fix.

Updated to "Major" priority, "Should Have" for "Next Mini Release".

Fix merged to release branch in r18165