Bug #51847

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

Added by Frans Saris about 8 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Reflection
Start date:
2013-09-09
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.4
Has patch:
No
Complexity:

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

No data to display

Also available in: Atom PDF