Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filemanger index issue (current master code on git) #1260

Closed
neoxu999 opened this issue Mar 14, 2014 · 1 comment
Closed

filemanger index issue (current master code on git) #1260

neoxu999 opened this issue Mar 14, 2014 · 1 comment

Comments

@neoxu999
Copy link

Filename: filemanger.php 30lines

there is no check for array 1 (directory array) so if there is no folder in the directory, it will show Warning: array_merge(): Argument #1 is not an array

$images = array_merge(glob($directory . '/' . $filter_name . '', GLOB_ONLYDIR), glob($directory . '/' . $filter_name . '.{jpg,jpeg,png,gif,JPG,JPEG,PNG,GIF}', GLOB_BRACE));

The correct way:
// Get all directories and files and merge them
$directoryArray = glob($directory . '/' . $filter_name . '', GLOB_ONLYDIR);
$filesArray = glob($directory . '/' . $filter_name . '
.{jpg,jpeg,png,gif,JPG,JPEG,PNG,GIF}', GLOB_BRACE);
$images = array();
if($directoryArray!=null){
$images = array_merge($directoryArray, $filesArray);
}else{
$images = $filesArray;
}

@danielkerr
Copy link
Member

will be a fix in next commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants