Bug #51847

Overiding controller actions with other required parameter sets results in fatal error.

Added by Frans Saris almost 2 years ago.

Status:New Start date:2013-09-09
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:Reflection
Target version:TYPO3 Flow Base Distribution - 2.x
PHP Version:5.4 Complexity:
Has patch:No Affected Flow version:Flow 2.0.0

Description

We have a own abstract controller with some actions without parameters.
When we extend this controller and override an action with a action that expects parameters we get the following Fatal error.

Fatal error: Call to a member function get() on a non-object in Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Mvc_Controller_ActionController.php on line 223

When we add default values for the properties it works.

Here a snippet to reproduce the problem:

class TestMyAbstractController extends \TYPO3\Flow\Mvc\Controller\ActionController {

    public function listAction() {
        return 'abstractList';
    }
}

class TestController extends TestMyAbstractController {

    /**
     * @param \TYPO3\Party\Domain\Model\AbstractParty $party
     */
    public function listAction(\TYPO3\Party\Domain\Model\AbstractParty $party) {
        return 'list';
    }

    /**
     * @param \TYPO3\Party\Domain\Model\AbstractParty $party
     */
    public function newAction(\TYPO3\Party\Domain\Model\AbstractParty $party) {
        return 'new';
    }

}

When we now call package/test/new we get the error: Fatal error: Call to a member function get() on a non-object in ....

Then we change:

    /**
     * @param \TYPO3\Party\Domain\Model\AbstractParty $party
     */
    public function listAction(\TYPO3\Party\Domain\Model\AbstractParty $party = NULL) {
        return 'list';
    }

Then when we call package/test/new we get the right error: Required argument "party" is not set.

tested in 2.0 beta 3, 2.0 and master

Also available in: Atom PDF