Issues

ZF-10244: adding action to controller messes up existing functions

Description

When you add an action to a controller that already has data in it, the closing curly brace before the function's closing on each function gets removed and the functions get some strange new indentation on everything but the first line.

I've been bitten by this a few times and thought it was fixed by now. I also thought I reported this before, but I can't see a bug report for it.

Comments

Steps to reproduce the issue:

zf create project test

Changed IndexController - indexAction to:

<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        if ($this->getRequest()->isPost()) {
            //something
            if ($form->isValid($_POST)) {
                //something
            }
        }
    }

}

cd test zf create action foo

And the IndexController looks this way:

<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        if ($this->getRequest()->isPost()) {
                    //something
                    if ($form->isValid($_POST)) {
                        //something
                    }
    }

    public function fooAction()
    {
        // action body
    }


}

still broken in 1.10.7

This problem is related to Zend_Reflection_Method::getBody(). See issue ZF-9018.

Greetings Ramon

Issue duplicated of ZF-9501

Removing fix version. Issues marked 'duplicate' don't need a fix version -- it makes them appear in the JIRA changelog and/or roadmap.