From 9251d2af6fe855fa14adaf87c05037e5ec5efc99 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 19 Feb 2017 10:13:40 +0000 Subject: [PATCH] Ensure that the spool path is set --- include/items.php | 9 ++++++--- include/spool_post.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/items.php b/include/items.php index 1e38e3fdb4..24eb1b30fb 100644 --- a/include/items.php +++ b/include/items.php @@ -860,9 +860,12 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa // We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates $file = 'item-'.round(microtime(true) * 10000).'-'.mt_rand().'.msg'; - $spool = get_spoolpath().'/'.$file; - file_put_contents($spool, json_encode($arr)); - logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG); + $spoolpath = get_spoolpath(); + if ($spoolpath != "") { + $spool = $spoolpath.'/'.$file; + file_put_contents($spool, json_encode($arr)); + logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG); + } return 0; } diff --git a/include/spool_post.php b/include/spool_post.php index 36bcab2a55..b4cce46b57 100644 --- a/include/spool_post.php +++ b/include/spool_post.php @@ -27,7 +27,7 @@ function spool_post_run($argv, $argc) { $path = get_spoolpath(); - if (is_writable($path)){ + if (($path != '') AND is_writable($path)){ if ($dh = opendir($path)) { while (($file = readdir($dh)) !== false) {