From 937821da68df9b8c83f77fb61a7bcc9dc2f202c5 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Fri, 6 May 2016 18:28:10 +0300 Subject: [PATCH] Fix. Do not populate invalid paths. (#1585) Problem when `opendir($dir)` returns `false` and then while cycle adds many empty strings which produce in the end ``` /etc/freeswitch/tls /etc/freeswitch/tls/ /etc/freeswitch/tls// /etc/freeswitch/tls/// /etc/freeswitch/tls//// /etc/freeswitch/tls///// /etc/freeswitch/tls////// /etc/freeswitch/tls/////// ``` --- app/edit/filelist.php | 2 +- app/edit/fileoptionslist.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/edit/filelist.php b/app/edit/filelist.php index 2fc19c56fa..8ee59f80a8 100644 --- a/app/edit/filelist.php +++ b/app/edit/filelist.php @@ -45,7 +45,7 @@ else { $htmlfilelist = ''; $dirlist = opendir($dir); $dir_array = array(); - while (false !== ($file = readdir($dirlist))) { + if($dirlist !== false) while (false !== ($file = readdir($dirlist))) { if ($file != "." AND $file != ".."){ $newpath = $dir.'/'.$file; $level = explode('/',$newpath); diff --git a/app/edit/fileoptionslist.php b/app/edit/fileoptionslist.php index 52124d2bfd..3b8d23b042 100644 --- a/app/edit/fileoptionslist.php +++ b/app/edit/fileoptionslist.php @@ -49,7 +49,7 @@ else { $htmlfilelist = ''; $dirlist = opendir($dir); $dir_array = array(); - while (false !== ($file = readdir($dirlist))) { + if($dirlist !== false) while (false !== ($file = readdir($dirlist))) { if ($file != "." AND $file != ".."){ $newpath = $dir.'/'.$file; $level = explode('/',$newpath);