Commit a8d507db authored by Serhii Klietsov's avatar Serhii Klietsov Committed by Nono Martinez
Browse files

Issue #2782183 by goodboy, Göran, izmeez, mpdonadio: mobile_detect_check_type() incorrect

parent 1b41ce05
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -89,10 +89,11 @@ function mobile_detect_get_object() {

function mobile_detect_check_type($type) {
  $detect = mobile_detect_get_object();
  $rules = array('Mobile', 'Tablet', 'Handheld') + $detect->getRules();
  $rules = array('Mobile', 'Tablet', 'Handheld');
  $rules = array_combine($rules, $rules) + $detect->getRules();
  $name = preg_replace('/^is/', '', $type);

  if (!in_array($name, $rules)) {
  if (!array_key_exists($name, $rules)) {
    watchdog('mobile_detect', 'Illegal access rule: %type',
      array('%type' => $type), WATCHDOG_ERROR);
    return FALSE;