diff --git a/src/Configula/Config.php b/src/Configula/Config.php index d31ae31..c50426a 100644 --- a/src/Configula/Config.php +++ b/src/Configula/Config.php @@ -158,7 +158,8 @@ public function getItem($item, $defaultValue = null) } elseif (strpos($item, '.') !== FALSE) { $cs = $this->configSettings; - if ($val = $this->getNestedVar($cs, $item)) { + $val = $this->getNestedVar($cs, $item); + if ($val !== null) { return $val; } diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index 79e0ba4..9b7821c 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -333,6 +333,19 @@ public function testNumberedConfiguatroniArrayKeysAreNotClobbered() $this->assertEquals(array(1,2,3,5), array_keys($result)); } + + // --------------------------------------------------------------- + + public function testDotSyntaxRetrievesItemsCorrectlyStrict() + { + $obj = new Configula\Config($this->configPath . '/../yaml'); + + $this->assertSame(true, $obj->getItem('i')); + $this->assertNotSame(1, $obj->getItem('i')); + $this->assertSame(false, $obj->getItem('j')); + $this->assertSame(true, $obj->getItem('section.k')); + $this->assertSame(false, $obj->getItem('section.l')); + } } /* EOF: PhpDriverTest.php */ diff --git a/tests/fixtures/yaml/bool.yml b/tests/fixtures/yaml/bool.yml new file mode 100644 index 0000000..e6a3177 --- /dev/null +++ b/tests/fixtures/yaml/bool.yml @@ -0,0 +1,5 @@ +i: true +j: false +section: + k: true + l: false \ No newline at end of file