diff --git a/Helper/Data.php b/Helper/Data.php index 61df2a6..12ce91e 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -202,13 +202,23 @@ public function getFileName($locale = 'en_US', $requiredExists = true) $vendor = $this->getLanguageVendor(); $directoryPath = $this->directoryList->getRoot() . '/app/i18n/' . $vendor . '/missing/'; if (!is_dir($directoryPath)) { - @mkdir($directoryPath, 0777, true); + $mkdirResult = mkdir($directoryPath, 0777, true); + if (false === $mkdirResult) { + throw new \Magento\Framework\Exception\LocalizedException( + new \Magento\Framework\Phrase('Failed to create directory %1', [$directoryPath]) + ); + } } // Fallback for e.g., Magento Cloud, where /app directory has no write access if (!is_dir($directoryPath)) { $directoryPath = $this->directoryList->getRoot() . '/var/i18n/' . $vendor . '/missing/'; if (!is_dir($directoryPath)) { - @mkdir($directoryPath, 0777, true); + $mkdirResult = mkdir($directoryPath, 0777, true); + if (false === $mkdirResult) { + throw new \Magento\Framework\Exception\LocalizedException( + new \Magento\Framework\Phrase('Failed to create directory %1', [$directoryPath]) + ); + } } }