Search

Hi

Do command options work as intended?

I have created a small console app with the command 'test' that just dumps out the following option value:

$this->addOption( 'boolean', 'b', InputOption::VALUE_OPTIONAL, 'A boolean value (defaults to false).', false );

Test 1: php command-test.php test Result: bool(false)

Test 2: php command-test.php test --boolean Result: bool(false) * Should this not be bool(true)?

Test 3: php command-test.php test -b Result: bool(false)

Test 4: php command-test.php test -b=true string(5) "=true" * Why is the = sign included?

Test 5: php command-test.php test --boolean=true string(4) "true" * Different result to the -b, no = sign.

Is this expected behaviour? How do you toggle boolean options via the command line?

Thanks for your help.

Cheers Sheath

This forum is for Symphony CMS, a content management system which is not related to the framework called Symfony.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details