Permalink
Browse files

Fixed Pimple::offsetExists

If the value set into container is null,
the offsetExists method will return false.
  • Loading branch information...
1 parent 5bd9649 commit ea954d20f37d5c13b318c4851d7137832cefbabb @lyrixx lyrixx committed Jun 11, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −1 lib/Pimple.php
  2. +3 −0 tests/Pimple/Tests/PimpleTest.php
View
@@ -90,7 +90,7 @@ function offsetGet($id)
*/
function offsetExists($id)
{
- return isset($this->values[$id]);
+ return array_key_exists($id, $this->values);
}
/**
@@ -92,8 +92,11 @@ public function testIsset()
return new Service();
};
+ $pimple['null'] = null;
+
$this->assertTrue(isset($pimple['param']));
$this->assertTrue(isset($pimple['service']));
+ $this->assertTrue(isset($pimple['null']));
$this->assertFalse(isset($pimple['non_existent']));
}

0 comments on commit ea954d2

Please sign in to comment.