From b2f43076aac56b30eab20d4e5b26434f3866e248 Mon Sep 17 00:00:00 2001 From: "Fedor A. Fetisov" Date: Mon, 28 Oct 2013 17:42:52 +0400 Subject: [PATCH] Add missed checks for the failed file openings --- src/mibew/libs/common/locale.php | 3 +++ src/mibew/operator/translate.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/mibew/libs/common/locale.php b/src/mibew/libs/common/locale.php index a2b194b7..ea94fc83 100644 --- a/src/mibew/libs/common/locale.php +++ b/src/mibew/libs/common/locale.php @@ -202,6 +202,9 @@ function read_locale_file($path) { $messages = array(); $fp = fopen($path, "r"); + if ($fp === FALSE) { + die("unable to read locale file $path"); + } while (!feof($fp)) { $line = fgets($fp, 4096); // Try to get key and value from locale file line diff --git a/src/mibew/operator/translate.php b/src/mibew/operator/translate.php index 781f0601..70a991fb 100644 --- a/src/mibew/operator/translate.php +++ b/src/mibew/operator/translate.php @@ -58,6 +58,9 @@ function save_message($locale, $key, $value) $added = false; $current_encoding = $mibew_encoding; $fp = fopen(dirname(dirname(__FILE__))."/locales/$locale/properties", "r"); + if ($fp === FALSE) { + die("unable to open properties for locale $locale"); + } while (!feof($fp)) { $line = fgets($fp, 4096); $keyval = preg_split("/=/", $line, 2);