From 55510bb1f84b6fc9409210566bbf4362f920e55b Mon Sep 17 00:00:00 2001 From: Mark Notton Date: Thu, 11 Oct 2018 13:58:00 +0100 Subject: [PATCH] Fixed - Moved previous version condition checker earlier in the function. --- src/services/Services.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/services/Services.php b/src/services/Services.php index 73ec2ad..8a778f7 100644 --- a/src/services/Services.php +++ b/src/services/Services.php @@ -103,6 +103,14 @@ public function check() { $index = array_search($this->name, array_column($rules, 'name')) ?? false; + // In some cases where user agents versions can't be read, + // they will default to 0. This can happen on new browser releases. + // To avoid the new browsers from being blocked, we have to allow these + // regardless of any other criteria. + if ($this->version == 0) { + return true; + } + // Check to see if the current browser name exists in any of the given argument rules if ( $index !== false) { @@ -110,14 +118,6 @@ public function check() { $condition = $rules[$index]['condition'] ?? false; $version = $rules[$index]['version'] ?? false; - // In some cases where user agents versions can't be read, - // they will default to 0. This can happen on new browser releases. - // To avoid the new browsers from being blocked, we have to allow these - // regardless of any other criteria. - if ($this->version == 0) { - return true; - } - if ($condition && $version) { // echo 'This is ' . $name . ' version ' . $this->version . '. And this website supports anything that is ' . $condition . ' version ' . $version . '
';