You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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;
}
The text was updated successfully, but these errors were encountered: