Skip to content

Commit e154dbb

Browse files
authored
Merge pull request #166 from m-safwan/fix_fetch_incorrect_keys
2 parents 679bba8 + bd11529 commit e154dbb

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/SettingStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ public function load($force = false)
231231
if (!$this->loaded || $force) {
232232
$this->data = $this->readData();
233233
$this->persistedData = $this->data;
234-
$this->data = array_merge($this->updatedData, $this->data);
234+
$this->data = $this->updatedData + $this->data;
235235
$this->loaded = true;
236236
}
237237
}

tests/functional/AbstractFunctionalTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,15 @@ public function defaults_are_respected()
145145
$this->assertStoreEquals($store, ['foo' => 'bar']);
146146
$this->assertStoreKeyEquals($store, ['foo', 'bar'], ['foo' => 'bar', 'bar' => 'default']);
147147
}
148+
149+
/** @test */
150+
public function numeric_keys_are_retrieved_correctly()
151+
{
152+
$store = $this->getStore();
153+
$store->set('1234', 'foo');
154+
$store->set('9876', 'bar');
155+
$store->load(true);
156+
$this->assertStoreEquals($store, ['1234' => 'foo', '9876' => 'bar']);
157+
$this->assertStoreKeyEquals($store, ['1234', '9876'], ['1234' => 'foo', '9876' => 'bar']);
158+
}
148159
}

0 commit comments

Comments
 (0)