Drupal: "Notice: Undefined index: ismobiledevice in at_get_browser() (line 217 of C:\***\adaptivetheme\at_core\inc\get.inc). "

browscap_get_browser() doesnt't provide this array property.

Comments

Jeff Burnz’s picture

Category: bug » support

The fact is this gets reported often for modules and themes that use browscap_get_browser() and none of us know why, it seems to strike some installations but for the most part not.

All I can suggest is tell us what browser/s etc you get this with (how to reproduce) and we add it to the collective knowledge of this problem.

Dzintars’s picture

Notice: Undefined index: ismobiledevice in at_get_browser() (line 217 of
/sites/all/themes/adaptivetheme/at_core/inc/get.inc).
Notice: Undefined index: ismobiledevice in at_get_browser() (line 217 of
/all/themes/adaptivetheme/at_core/inc/get.inc).
Notice: Undefined index: ismobiledevice in at_get_browser() (line 217 of
/all/themes/adaptivetheme/at_core/inc/get.inc).
Notice: Undefined index: ismobiledevice in browscap_block_block_list_alter() (line 78 of /sites/all/modules/browscap_block/browscap_block.module).
Notice: Undefined index: ismobiledevice in at_get_browser() (line 217 of
/sites/all/themes/adaptivetheme/at_core/inc/get.inc).
Notice: Undefined index: ismobiledevice in at_get_browser() (line 217 of
/sites/all/themes/adaptivetheme/at_core/inc/get.inc).

This is Notice of my site

overbid’s picture

I use Colora and got this error but just enable Adeptivetheme this bug is gone away

deweweb’s picture

have the same problem with AT theme and At panels everywhere. any suggestions?

Anonymous’s picture

I didn't get it until I uninstalled, then reinstalled browscap. Thought I checked all of the same settings, but Mozilla Firefox now has this same error. Is it possibly a setting that I overlooked?

Jeff Burnz’s picture

Status: Active » Closed (cannot reproduce)
ashtronaut’s picture

I had this same problem. I believe this issue is caused because The Browser Capabilities Project Is Closed!

The fix is here (This made my errors go away)

the issue can be fixed by replacing the urls in import.inc in the browscap module. I understand this is a browscap module issue but as it affects this module I thought I would post the info:

In import.inc in the browscap folder change the $current_version url to :
http://tempdownloads.browserscap.com/versions/version-number.php
(both https and http, as no https is offered right now, need changed)

In import.inc in the browscap folder change the $browscap_data url to :
http://tempdownloads.browserscap.com/stream.php?BrowsCapINI
(both https and http, as no https is offered right now, need changed)

Cyclodex’s picture

For me it was an issue in browscap, the URL seems to be wrong, changing the url fixed for me this issue.
My DB table "browscap" had about 66 entries, which is wrong. It should be more, so I came across comment 2 in #1852184: Browscap error parsing when trying to fetch browscap data which fixed the list, and therefore my browser now matches again.

But I also think to rely on the $browser['ismobiledevice'] is a bit unhappy. Probably the module should first check for isset/!empty and throw an error into watchdog instead.

robertgarrigos’s picture

Issue summary: View changes
astutonet’s picture

Status: Closed (cannot reproduce) » Active

Hi.

I'm starting a new clean project, using Browscap module and Adaptivetheme and I am also having this same issue.

I did some research for possible solutions and so far none of the suggestions was able to solve the problem of my installation.

Components:

D 7.27, Browscap 7.x-2.1, AdaptiveTheme 7.x-3.x-dev e AT Commerce 7.x-3.x-dev.

Registered Error:

"Notice: Undefined index: ismobiledevice in at_get_browser() (line 228 of C:\wamp\www\mysite\sites\all\themes\adaptivetheme\at_core\inc\get.inc)."

Browsers for testing:

Firefox 28.0, Chrome 34.0, IE 10, Opera 12.16. The same error was logged in use of all the browsers in question.

Changes already processed:

My tests have been performed as described in #7 and #9 (all results of my research suggest changes to the file browscap/import.inc, but the changes were not able to solve the issue).

As can be seen in https://drupal.org/node/2232795, there were changes in the operation of the Browscap module. Occurs that the Adaptivetheme depends of the Browscap module for perfect operation.

Note: This issue only affects new installations.

Any idea?

Tks.

Jeff Burnz’s picture

Status: Active » Closed (cannot reproduce)

the Adaptivetheme depends of the Browscap module for perfect operation

No it doesn't, you can use Mobile Detect.

astutonet’s picture

Status: Closed (cannot reproduce) » Active
astutonet’s picture

No it doesn't, you can use Mobile Detect.

Ok, but this don't solve this issue. Any solution, please??!!

Jeff Burnz’s picture

Status: Active » Closed (cannot reproduce)

I think it is well covered that the issue is with Browscap module, not with this theme, or any other project that attempts to leverage this broken module, when we started using Browscap it worked very well, however since then the module nor the Browscap lib (afaict) has been that well maintained , after considerable time waiting for things to resolve they did not so we now rely on Mobile Detect module.

Mobile Detect does solve the issue, it's why I spent CONSIDERABLE time integrating it and getting this theme to at least have a viable option for doing device detection, with group device detection to boot.

Understand this - not a single user has posted an issue about Mobile Detect since I did this, clearly it works and gets the job done.

Sorry, but reopening this issue with exasperated over punctuation is NOT the way forward - the onus is on you to understand the issue from a technical and implementation standpoint - indeed I and others have explained and discussed this over multiple threads on this site. Others have attempted to post solutions that worked for some, not for others - that is my experience in a nutshell with Browscap - it works for some, not for others, I said that right at the beginning of this issue.

I do not have a magic wand with which to swish over your site and it will somehow miraculously start working. OK?

astutonet’s picture

I do not have a magic wand with which to swish over your site and it will somehow miraculously start working. OK?

Ok, to some extent you are right. But...

I think we live in a community, where some things require explanation and the simple fact of retaining information does not help anyone.

For example, the solution proposed in #7 above works effectively, if after applying the patches, you access the page of Browscap module (in admin/config/system/browscap) and click in refresh browscap data.

After that, everything will work perfectly.

This is my tip ;-b

Good luck!

crutch’s picture

Browscap continues to be a big pain. After making the necessary code updates, it may help to disable and then re-enable the module. That did the trick this time.

What I ended up with browscap@import.inc

function _browscap_import($cron = TRUE) {
  // Check the local browscap data version number
  $local_version = variable_get('browscap_version', 0);

  // Retrieve the current browscap data version number using HTTP
  $current_version = drupal_http_request('http://browscap.org/version-number');

  // Log an error if the browscap version number could not be retrieved
  if (isset($current_version->error)) {
    // Log a message with the watchdog
    watchdog('browscap', "Couldn't check version: %error", array('%error' => $current_version->error), WATCHDOG_ERROR);

    // Display a message to the user if the update process was triggered manually
    if ($cron == FALSE) {
      drupal_set_message(t("Couldn't check version: %error", array('%error' => $current_version->error)), 'error');
    }

    return;
  }

  // Sanitize the returned version number
  $current_version = check_plain(trim($current_version->data));

  // Compare the current and local version numbers to determine if the browscap
  // data requires updating
  if ($current_version == $local_version) {
    // Log a message with the watchdog
    watchdog('browscap', 'No new version of browscap to import');

    // Display a message to the user if the update process was triggered manually
    if ($cron == FALSE) {
      drupal_set_message(t('No new version of browscap to import'));
    }

    return;
  }

  // Retrieve the browscap data using HTTP
  $browscap_data = drupal_http_request('http://browscap.org/stream?q=PHP_BrowsCapINI');
manoloka’s picture

No improvements with this issue?

I'm getting the same notice;

Notice: Undefined index: ismobiledevice in at_get_browser() (line 228 of /usr/home/mysite/www/sites/all/themes/adaptivetheme/at_core/inc/get.inc).

undersea time’s picture

There was only one thing that worked for me after trying almost everything suggested here for the same notice - I manually cleared the cache_browscap table and that seems to have taken care of it. This might be why uninstalling and reinstalling the browscap module fixes it. (I couldn't uninstall the module because of other dependencies.) I hope this helps some people.

WormFood’s picture

Status: Closed (cannot reproduce) » Closed (works as designed)

I'm updating the status of this, because I can reproduce this problem, and it has absolutely nothing to do with AdaptiveTheme, and everything to do with browscap.
You can do the following to reproduce this problem:
1. Disable browscap.
2. Uninstall browscap, to clear the browscap database.
3. Enable browscap, but don't update it. Verify the browscap config page says "Current browscap data version: Never fetched." (when I first did this, I couldn't access the browscap config page, even tho it was enabled. I had to disable it, and enable it again, before it'd work right).
4. Observe the warning message is present.
5. Update the browscap database.
6. Observe warning message is no longer present.
Note: When I enabled browscap with Drush, it also downloaded, and updated the browscap database at the same time. When I enabled browscap through the web based interface, it didn't seem to try to download/update the browscap database.

Browscap is a PIG, as of version 7.x-2.2. My problems were caused by not being able to update the browscap database. When first installed, browscap has no database of devices, to determine your browser capabilities. It downloads this database, over the web, and imports it into the Drupal database. That would be great, if it actually worked all the time. The problem is, the process to download and install the browscap database is so slow, and memory intensive, it kept failing for me. I had to increase my ram (in php settings) from 150 megs, to 180 megs, and increase the execution timeout from 30 to 60 seconds, in order to be able to update browscap from the web based interface. Drush worked for me, because it's a CLI app, and gets different PHP settings than the web page does. Cron never seemed to have updated the browscap database. Once browscap is updated, at least once, this problem goes away. That is why this problem affects new installations.

What I have documented above, clearly shows this problem is related to browscap not updating it's database, so anyone else with this problem, can start looking at browscap for a fix.

PS. This page comes up pretty high on Google, when searching for this problem, which is why I've taken the time to clearly document this, so other people with this same problem will have a clear understanding of what exactly the problem really is.