From ac829d4f148784581092c371cad1f48f6b40b13a Mon Sep 17 00:00:00 2001 From: Rafael de Camargo Date: Sat, 3 Aug 2019 22:28:04 -0300 Subject: Add error checks to glob function GLOB_ERR will throw errors if an error occurs, such as lack of permission GLOB_NOCHECK will return the pattern if no file is found, this makes the file_exists check valid --- app/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/functions.php') diff --git a/app/functions.php b/app/functions.php index ada96d97..e5b2977b 100644 --- a/app/functions.php +++ b/app/functions.php @@ -6,7 +6,7 @@ function concat_files(array $files) { $data = ''; foreach ($files as $pattern) { - foreach (glob($pattern) as $filename) { + foreach (glob($pattern, GLOB_ERR | GLOB_NOCHECK) as $filename) { echo $filename.PHP_EOL; if (! file_exists($filename)) { die("$filename not found\n"); -- cgit v1.2.3