I have run into a scenario where $info['ismobiledevice'] = 'false'. Its a string false, not a boolean false, so any IF statement that is expecting a boolean value will break since 'false' evaluates to TRUE.

Looking into it a bit further and it appears that all boolean values are being stored as string 'true' and 'false' in the serialized 'data' column in the database.

This is only happening when testing on a site hosted on amazon. I have MAMP running locally and this problem doesn't happen. I have not been able to determine what exactly is causing it, maybe a different version of mysql?

Here is the database version I'm using on amazon which is having the issues:

mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+--------------------+
| Variable_name           | Value              |
+-------------------------+--------------------+
| protocol_version        | 10                 |
| version                 | 5.1.41-3ubuntu12.6 |
| version_comment         | (Ubuntu)           |
| version_compile_machine | i486               |
| version_compile_os      | debian-linux-gnu   |
+-------------------------+--------------------+
5 rows in set (0.00 sec)

here is a related issue: #919578: browscap_is_crawler is broken

CommentFileSizeAuthor
#1 browscap-923374.patch941 bytesbschilt
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bschilt’s picture

Status: Active » Needs review
FileSize
941 bytes

Here is a patch that will turn the string 'true' and 'false' values back into booleans. This patch is more like a bandaid, it would be better to have the values saved as booleans in the database instead of strings.

The patch will also resolve #919578: browscap_is_crawler is broken. I essentially used the same technique that judahtanthony used to patch issue #919578 but applied it a bit higher up in the call stack.

rsevero’s picture

Status: Needs review » Closed (duplicate)