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
This commit is contained in:
parent
355de9fb45
commit
ac829d4f14
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue