Posted by dsdeiz on January 25, 2013 at 11:08am
3 followers
Jump to:
| Project: | Mobile Tools |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi,
I think the property ismobiledevice for mt_browscap_is_mobile_device returns a string now. Not sure whether it's an update on browscap or some other thing. Anyway, attached the patch that might help.
| Attachment | Size |
|---|---|
| ismobiledevice-property-1.patch | 604 bytes |
Comments
#1
Shouldn't this be fixed in browscap.module? Something like:
--- Base (BASE)
+++ Locally Modified (Based On LOCAL)
@@ -184,6 +184,14 @@
// Unserialize the user agent data found in the cache or the database
$properties = unserialize($user_agent_properties->data);
+ // Unserialization makes all values strings so here we cast the boolean
+ // ones to boolean. The string "false" is evaluated as TRUE in if("false").
+ foreach ($properties as $key => &$value) {
+ if (in_array($value, array('true', 'false'))) {
+ eval('$value = ' . $value . ';');
+ }
+ }
+
// Set the user agent name and name pattern
$properties['useragent'] = $user_agent;
$properties['browser_name_pattern'] = strtr($user_agent_properties->useragent, '%_', '*?');
... in browscap_get_browser function?