Commit 869e7a51 authored by Robin McCorkell's avatar Robin McCorkell
Browse files

Prevent error in files_trashbin

`glob` can return FALSE when the directory is empty, instead of an empty array,
causing an error at `foreach`.

"Note: On some systems it is impossible to distinguish between empty match and
an error."

See http://www.php.net/manual/en/function.glob.php -> Return Values
parent fa881490
......@@ -824,13 +824,15 @@ class Trashbin {
$matches = glob($escapedVersionsName . '*');
}
foreach ($matches as $ma) {
if ($timestamp) {
$parts = explode('.v', substr($ma, 0, $offset));
$versions[] = (end($parts));
} else {
$parts = explode('.v', $ma);
$versions[] = (end($parts));
if (is_array($matches)) {
foreach ($matches as $ma) {
if ($timestamp) {
$parts = explode('.v', substr($ma, 0, $offset));
$versions[] = (end($parts));
} else {
$parts = explode('.v', $ma);
$versions[] = (end($parts));
}
}
}
return $versions;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment