From bb0c09e994869b216b8163d262ffc7db9d439221 Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Tue, 14 Apr 2015 14:06:58 +0200 Subject: [PATCH] Adding a final fallback for findBinaryPath --- lib/private/helper.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/private/helper.php b/lib/private/helper.php index cb95dd49be..11311d7c55 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -931,7 +931,12 @@ class OC_Helper { // Returns null if nothing is found $result = $exeSniffer->find($program); if (empty($result)) { - $paths = str_replace(':','/ ',getenv('PATH')); + $paths = getenv('PATH'); + if (empty($paths)) { + $paths = '/usr/local/bin /usr/bin /opt/bin /bin'; + } else { + $paths = str_replace(':',' ',getenv('PATH')); + } $command = 'find ' . $paths . ' -name ' . escapeshellarg($program) . ' 2> /dev/null'; exec($command, $output, $returnCode); if (count($output) > 0) {