I am getting this error logged for browscap.module, line 392 or 397.

Checking function browscap_get_browser(), I've noticed that the only return clause (return $info;) is conditional. I suppose this can be the reason that in certain circumstances this function doesn't return an object, as expected in lines 392 and 397.

So, I believe we should:
1. ensure the returned value of browscap_get_browser() function is always an object (so we can be sure $browser in lines after 391 is always an object), or
2. check if $browser is an object or not after browscap_get_browser() call (in line 391)

Members fund testing for the Drupal project. Drupal Association Learn more


alexweber’s picture

Status: Active » Needs review
1.28 KB

There is already a check in place for this in browscap_exit(), I just added the same logic to browscap_unmonitor() and it fixes the issue, patch is attached.

- Alex

alexweber’s picture

sorry double post, slow internet here :(

BBC’s picture

I'm seeing the same behavior in the logs, but the patch in #1 seems to be broken. alexweber, any chance that you can resubmit your patch? I'd be happy to help test.

Devin Carlson’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Category: support » bug

I'm not sure how the URL to the patch in #1 got messed up, but the patch can be found at http://drupal.org/files/issues/browscap-1025236.patch.

alexweber’s picture

I haven't checked on this in a while but there's a decent chance it won't apply clean to the current dev release. Re-roll anyone?

Devin Carlson’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Assigned: Unassigned » Devin Carlson
3.88 KB

The attached patch cleans up browscap_get_browser() and ensures that a set of default values are returned when there is no data on the visiting user agent.

Devin Carlson’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)

Committed to 7.x-1.x.

Devin Carlson’s picture

Status: Patch (to be ported) » Needs review
3.84 KB

Backport of #6.

Devin Carlson’s picture

Status: Needs review » Fixed

Committed to 6.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.