Skip to content

Commit

Permalink
Changed config load procedure
Browse files Browse the repository at this point in the history
In PHP 5.5.5 will includes cached buggy by opcache. Changes in the jsonconfig will not detected correctly. Now the method uses file_get_contents and a regular expression.
  • Loading branch information
perryflynn committed Feb 11, 2014
1 parent 741ad1f commit cf04849
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/jsonconfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,16 @@ public function loadConfiguration() {
$this->createConfiguration();
}

include($this->configname);
if(!isset($config)) {
$cfgc = file_get_contents($this->configname);
$rgx = '/\$config = \<\<\<HEREDOC\n(.*?)\nHEREDOC;/s';
$result = preg_match($rgx, $cfgc, $match);

if($result!==1)
{
throw new \Exception("Configuration not found");
}


$config = $match[1];
$config = @json_decode(trim($config), true);
if(!is_array($config)) {
throw new \Exception("Could not decode configuration");
Expand Down

0 comments on commit cf04849

Please sign in to comment.