// When reading the config file too fast, we get a wrong filesize, "clearstatcache" prevents that
clearstatcache(true, $filename);
$content = fread($configStream, filesize($filename));
- // Event truncating the whole content wouldn't automatically rewind the stream,
- // so we need to do it manually
- rewind($configStream);
if (!$content) {
throw new ConfigFileException(sprintf('Cannot read file %s', $filename));
}
+ // Event truncating the whole content wouldn't automatically rewind the stream,
+ // so we need to do it manually
+ rewind($configStream);
+
$dataArray = eval('?>' . $content);
// Merge the new content into the existing file based config cache and use it
$data = $configCache->getDataBySource(Cache::SOURCE_DATA);
$encodedData = ConfigFileTransformer::encode($data);
-
if (!$encodedData) {
throw new ConfigFileException('config source cannot get encoded');
}
$categories = array_keys($data);
foreach ($categories as $category) {
-
if (is_null($data[$category])) {
$dataString .= "\t'$category' => null," . PHP_EOL;
continue;