Bug #30491

Commands with only one optional argument don't work

Added by Martin Br├╝ggemann about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
-
Target version:
-
Start date:
2011-09-30
Due date:
% Done:

0%

Estimated time:

Description

I kickstarted a command controller and added one command action with one optional argument:

[...]

class TestCommandController extends \TYPO3\FLOW3\MVC\Controller\CommandController {

    /**
     * Render the documentation for a specific package.
     * 
     * @param string $packageKey The unique package key
     * @return void
     */
    public function renderCommand($packageKey = NULL) {
    echo 'THIS IS '.$packageKey; 
        exit;
    }

If I start the controller with:

./flow3 test:render TYPO3.TheDefinitiveGuideToFLOW3

it outputs:

THIS IS 

If I make the argument $packageKey required everything works fine and de render command outputs:

THIS IS TYPO3.TheDefinitiveGuideToFLOW3

Bug or feature?

#1

Updated by Robert Lemke about 10 years ago

  • Status changed from New to Closed

Feature. The simple rule is: optional arguments must always be named.

The reason is that FLOW3 otherwise would not be able to distinguish between options and unnamed required arguments or exceeding arguments.

Also available in: Atom PDF