From 51c0a9301c9c4c640655ffa67dd9e2225d302860 Mon Sep 17 00:00:00 2001 From: Flavio Copes Date: Sun, 17 Jan 2016 23:08:19 +0100 Subject: [PATCH] Better solution for previous commit. On Linux `glob` might return false. Check prior to casting to array. From the PHP manual: on some systems it is impossible to distinguish between empty match and an error. --- admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin.php b/admin.php index 67ece8c7..775a1fd8 100644 --- a/admin.php +++ b/admin.php @@ -96,10 +96,10 @@ class AdminPlugin extends Plugin // check for existence of a user account $account_dir = $file_path = $this->grav['locator']->findResource('account://'); - $user_check = (array) glob($account_dir . '/*.yaml'); + $user_check = glob($account_dir . '/*.yaml'); // If no users found, go to register - if (count($user_check) == 0 || (count($user_check) == 1 && reset($user_check) == false)) { + if ($user_check == false || count((array)$user_check) == 0) { if (!$this->isAdminPath()) { $this->grav->redirect($this->base); }