Bug #38980

ActionController: behavior of required arguments is not consistent

Added by Adrian Föder about 3 years ago. Updated about 1 year ago.

Status:New Start date:2012-07-16
Priority:Must have Due date:
Assigned To:- % Done:

0%

Category:Validation
Target version:-
PHP Version: Complexity:
Has patch:No Affected Flow version:(any)

Description

consider the following action controller case:

1    /**
2     * @param string $term
3     * @FLOW3\Validate("$term", type="NotEmpty")
4     * @return void
5     */
6    public function indexAction($term) {
7        $this->view->assign('term', $term);
8    }

the following happens:

  • calling acme.package/search?term=foo everything's fine
  • calling acme.package/search?term= fine, too, the validator kicks in and the output is An error occurred while trying to call Acme\Package\Controller\SearchController->indexAction(). Error for term: This property is required.
  • calling acme.package/search an Exception occurs, telling #1298012500: Required argument "term" is not set. But this exception makes one unable to catch this case smoothly with the same treatment that'd apply for an empty, but set term.

Side note: if defining $term = NULL in the method header, nothing at all happens when providing no term argument.

Am I expecting something wrong or is there a bug / unintended behavior?

Also available in: Atom PDF