summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2010-03-22 19:33:34 +0000
committerUrban Müller2010-03-22 19:33:34 +0000
commit617517b1426c57b9505b65ea532e5fea9fc5a708 (patch)
tree699d058d453bfb9bcdc3cf8e513b979f90fabdff
parent66b36021e6ffd62450c446682688aff4ff0d19d1 (diff)
downloaditools-617517b1426c57b9505b65ea532e5fea9fc5a708.tar.gz
itools-617517b1426c57b9505b65ea532e5fea9fc5a708.tar.bz2
itools-617517b1426c57b9505b65ea532e5fea9fc5a708.zip
handle empty files
-rw-r--r--it.class4
1 files changed, 2 insertions, 2 deletions
diff --git a/it.class b/it.class
index 2fc4b35..ab4d87b 100644
--- a/it.class
+++ b/it.class
@@ -747,7 +747,7 @@ static function mail($p)
static function file_get($filename, $p = array())
{
$data = file_get_contents($filename == "-" ? "php://stdin" : $filename);
- if ($p['keyval'])
+ if ($p['keyval'] && $data !== false)
{
foreach (explode("\n", rtrim($data, "\n")) as $line)
{
@@ -756,7 +756,7 @@ static function file_get($filename, $p = array())
}
}
else if ($p['lines'])
- $result = explode("\n", rtrim($data, "\n"));
+ $result = $data !== false ? explode("\n", rtrim($data, "\n")) : array();
else
$result = $data;