Closed (fixed)
Project:
Browscap
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Jan 2011 at 08:14 UTC
Updated:
1 Mar 2012 at 13:20 UTC
Jump to comment: Most recent file
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)
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | cleanup-and-ensure-returned-value-1025236-8.patch | 3.84 KB | devin carlson |
| #6 | cleanup-and-ensure-returned-value-1025236-6.patch | 3.88 KB | devin carlson |
| #1 | browscap-1025236.patch | 1.28 KB | alexweber |
Comments
Comment #1
alexweber commentedThere 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
Comment #2
alexweber commentedsorry double post, slow internet here :(
Comment #3
bbcI'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.
Comment #4
devin carlson commentedI'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.
Comment #5
alexweber commentedI 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?
Comment #6
devin carlson commentedThe 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.Comment #7
devin carlson commentedCommitted to 7.x-1.x.
Comment #8
devin carlson commentedBackport of #6.
Comment #9
devin carlson commentedCommitted to 6.x-1.x.