Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch '2.1'

* 2.1:
  [Yaml] fixed default value
  Added Yaml\Dumper::setIndentation() method to allow a custom indentation level of nested nodes.
  added a way to enable/disable object support when parsing/dumping
  added a way to enable/disable PHP support when parsing a YAML input via Yaml::parse()
  fixed CS
  [Process] Fix docblocks, remove `return` from `PhpProcess#start()` as parent returns nothing, cleaned up `ExecutableFinder`
  fixes a bug when output/error output contains a % character
  [Console] fixed input bug when the value of an option is empty (closes #6649, closes #6689)
  [Profiler] [Redis] Fix sort of profiler rows.
  Fix version_compare() calls for PHP 5.5.
  Removed underscores from test method names to be consistent with other components.
  [Process] In edge cases `getcwd()` can return `false`, then `proc_open()` should get `null` to use default value (the working dir of the current PHP process)
  Fix version_compare() calls for PHP 5.5.
  Handle the deprecation of IntlDateFormatter::setTimeZoneId() in PHP 5.5.
  removed the .gitattributes files (closes #6605, reverts #5674)
  [HttpKernel] Clarify misleading comment in ExceptionListener

Conflicts:
	src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig
	src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
	src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
	src/Symfony/Component/Form/Tests/Util/PropertyPathTest.php
	src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php
	src/Symfony/Component/Process/Process.php
  • Loading branch information...
commit b76fc0d327cb8d90ef0d685f3d696dab714b8327 2 parents d51d040 + e9824f3
@fabpot fabpot authored
View
2  .gitattributes
@@ -1,2 +0,0 @@
-/Tests export-ignore
-phpunit.xml.dist export-ignore
View
6 Input/ArgvInput.php
@@ -215,12 +215,14 @@ private function addLongOption($name, $value)
$option = $this->definition->getOption($name);
- if (null === $value && $option->acceptValue()) {
+ if (null === $value && $option->acceptValue() && count($this->parsed)) {
// if option accepts an optional or mandatory argument
// let's see if there is one provided
$next = array_shift($this->parsed);
- if ('-' !== $next[0]) {
+ if (isset($next[0]) && '-' !== $next[0]) {
$value = $next;
+ } elseif (empty($next)) {
+ $value = '';
} else {
array_unshift($this->parsed, $next);
}
View
2  Tests/Fixtures/Foo4Command.php
@@ -8,4 +8,4 @@ protected function configure()
{
$this->setName('foo3:bar:toh');
}
-}
+}
View
12 Tests/Input/ArgvInputTest.php
@@ -71,6 +71,18 @@ public function testParser()
$input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_REQUIRED))));
$this->assertEquals(array('foo' => 'bar'), $input->getOptions(), '->parse() parses short options with a required value (with a space separator)');
+ $input = new ArgvInput(array('cli.php', '-f', ''));
+ $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL))));
+ $this->assertEquals(array('foo' => ''), $input->getOptions(), '->parse() parses short options with an optional empty value');
+
+ $input = new ArgvInput(array('cli.php', '-f', '', 'foo'));
+ $input->bind(new InputDefinition(array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL))));
+ $this->assertEquals(array('foo' => ''), $input->getOptions(), '->parse() parses short options with an optional empty value followed by an argument');
+
+ $input = new ArgvInput(array('cli.php', '-f', '', '-b'));
+ $input->bind(new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b'))));
+ $this->assertEquals(array('foo' => '', 'bar' => true), $input->getOptions(), '->parse() parses short options with an optional empty value followed by an option');
+
$input = new ArgvInput(array('cli.php', '-f', '-b', 'foo'));
$input->bind(new InputDefinition(array(new InputArgument('name'), new InputOption('foo', 'f', InputOption::VALUE_OPTIONAL), new InputOption('bar', 'b'))));
$this->assertEquals(array('foo' => null, 'bar' => true), $input->getOptions(), '->parse() parses short options with an optional value which is not present');
Please sign in to comment.
Something went wrong with that request. Please try again.