Bug #51255

CommandController: Fix parsing of boolean values

Added by Timo Dödtmann about 8 years ago. Updated over 7 years ago.

Status:
Resolved
Priority:
Should have
Category:
Command
Target version:
-
Start date:
2013-08-22
Due date:
% Done:

0%

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

Description

I have the following (awesome) command:

<?php
namespace Acme\Demo\Command;

use TYPO3\Flow\Annotations as Flow;

/**
 * TestCommand
 *
 * @Flow\Scope("singleton")
 */
class MyCommandController extends \TYPO3\Flow\Cli\CommandController {

    /**
     * @param boolean $myParam A boolean value
     * @return void
     */
    public function commandCommand($myParam) {
        echo sprintf("Result: %s\n\n", var_export($myParam, 1));
    }

}

Now, it will be called in the terminal as followed:

$ ./flow my:command --myParam FALSE
Result: bool (false)

$ ./flow my:command --myParam=FALSE
Result: bool (true)

The last command returns `TRUE` but `FALSE` is passed, because the passed value is interpreted as a string (probably because of the prefix `=`).

I'm not quite sure if it is really a bug, but it would be nice if it is interpreted as "bool (false)".


Related issues

Related to TYPO3.Flow - Bug #59023: BooleanConverter should not convert empty values to booleanNew2014-05-22

Actions
Is duplicate of TYPO3.Flow - Bug #51385: BooleanConverter considers "false" TRUEResolvedBastian Waidelich2013-08-27

Actions

Also available in: Atom PDF