Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\Exception\RuntimeException;
use Magento\Framework\Filesystem\DriverPool;
use Magento\Framework\Phrase;

/**
* Deployment configuration reader.
Expand Down Expand Up @@ -87,6 +89,7 @@ public function getFiles()
* @param string $fileKey The file key (deprecated)
* @return array
* @throws FileSystemException If file can not be read
* @throws RuntimeException If file is invalid
* @throws \Exception If file key is not correct
* @see FileReader
*/
Expand All @@ -99,6 +102,9 @@ public function load($fileKey = null)
$filePath = $path . '/' . $this->configFilePool->getPath($fileKey);
if ($fileDriver->isExists($filePath)) {
$result = include $filePath;
if (!is_array($result)) {
throw new RuntimeException(new Phrase("Invalid configuration file: '%1'", [$filePath]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add corresponding @throws line into method PHPDoc.

}
}
} else {
$configFiles = $this->configFilePool->getPaths();
Expand All @@ -108,11 +114,14 @@ public function load($fileKey = null)
$configFile = $path . '/' . $this->configFilePool->getPath($fileKey);
if ($fileDriver->isExists($configFile)) {
$fileData = include $configFile;
if (!is_array($fileData)) {
throw new RuntimeException(new Phrase("Invalid configuration file: '%1'", [$configFile]));
}
} else {
continue;
}
$allFilesData[$configFile] = $fileData;
if (is_array($fileData) && count($fileData) > 0) {
if ($fileData) {
$result = array_replace_recursive($result, $fileData);
}
}
Expand Down