Bug #38980

ActionController: behavior of required arguments is not consistent

Added by Adrian Föder over 9 years ago. Updated over 7 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Validation
Target version:
-
Start date:
2012-07-16
Due date:
% Done:

0%

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

Description

consider the following action controller case:

    /**
     * @param string $term
     * @FLOW3\Validate("$term", type="NotEmpty")
     * @return void
     */
    public function indexAction($term) {
        $this->view->assign('term', $term);
    }

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?

No data to display

Also available in: Atom PDF