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///////
```
This commit is contained in:
Alexey Melnichuk 2016-05-06 18:28:10 +03:00 committed by FusionPBX
parent f828c1c56b
commit 840ea3faa4
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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);