Skip to content

Commit

Permalink
[OptionsResolver] Fix Options::has() when the value is null
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Jul 30, 2012
1 parent 6b39ebc commit a47922b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/Component/OptionsResolver/Options.php
Expand Up @@ -247,7 +247,7 @@ public function get($option)
*/
public function has($option)
{
return isset($this->options[$option]);
return array_key_exists($option, $this->options);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php
Expand Up @@ -462,4 +462,11 @@ public function testOptionsIteration()

$this->assertEquals($expectedResult, iterator_to_array($this->options, true));
}

public function testHasWithNullValue()
{
$this->options->set('foo', null);

$this->assertTrue($this->options->has('foo'));
}
}

0 comments on commit a47922b

Please sign in to comment.