diff --git a/src/SettingStore.php b/src/SettingStore.php index d5e8286..3375158 100644 --- a/src/SettingStore.php +++ b/src/SettingStore.php @@ -231,7 +231,7 @@ public function load($force = false) if (!$this->loaded || $force) { $this->data = $this->readData(); $this->persistedData = $this->data; - $this->data = array_merge($this->updatedData, $this->data); + $this->data = $this->updatedData + $this->data; $this->loaded = true; } } diff --git a/tests/functional/AbstractFunctionalTest.php b/tests/functional/AbstractFunctionalTest.php index 041707a..954446f 100644 --- a/tests/functional/AbstractFunctionalTest.php +++ b/tests/functional/AbstractFunctionalTest.php @@ -145,4 +145,15 @@ public function defaults_are_respected() $this->assertStoreEquals($store, ['foo' => 'bar']); $this->assertStoreKeyEquals($store, ['foo', 'bar'], ['foo' => 'bar', 'bar' => 'default']); } + + /** @test */ + public function numeric_keys_are_retrieved_correctly() + { + $store = $this->getStore(); + $store->set('1234', 'foo'); + $store->set('9876', 'bar'); + $store->load(true); + $this->assertStoreEquals($store, ['1234' => 'foo', '9876' => 'bar']); + $this->assertStoreKeyEquals($store, ['1234', '9876'], ['1234' => 'foo', '9876' => 'bar']); + } }