Skip to content

Commit

Permalink
Fix issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Jan 20, 2015
1 parent a5d80ee commit cdf9c62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,12 @@ public function offsetGet($id)
*/
private function get_cache_key($name)
{
if ($this->cache_key)
if (!$this->cache_key)
{
return $this->cache_key;
$this->cache_key = substr(sha1(implode('|', array_keys($this->paths))), 0, 8);
}

$hash = substr(sha1(implode('|', array_keys($this->paths))), 0, 8);

return $this->cache_key = $hash . '_' . $name;
return $this->cache_key . '_' . $name;
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ public function test_states_with_cache()

$this->assertNotSame($app1, $app2);
$this->assertSame($app2, $app3);
$this->assertNotSame($app3, $configs->synthesize('event', 'recursive merge'));
}
}
8 changes: 8 additions & 0 deletions tests/fixtures/config02/event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [

'one' => "one",
'two' => "two"

];

0 comments on commit cdf9c62

Please sign in to comment.