Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
- Moved previous version condition checker earlier in the function.
  • Loading branch information
Mark Notton committed Oct 11, 2018
1 parent 288f0fc commit 55510bb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/services/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,21 @@ 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) {

$name = $rules[$index]['name'];
$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 . '<br />';
Expand Down

0 comments on commit 55510bb

Please sign in to comment.