Hi,
I recently had an issue with the hearbeat streams that use language conditions in their query when one of the languages have a '-' in their language code (like en-gb or en-US). A PDOException like this was thrown:
PDOException: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined: SELECT ha.*, hut.status AS access_status FROM {heartbeat_activity} ha LEFT OUTER JOIN {heartbeat_user_templates} hut ON ha.uid = hut.uid AND ha.message_id = hut.message_id WHERE (ha.uaid = :db_condition_placeholder_0) AND ( ha.language IN (:languages_und, :languages_en-gb) ) ; Array ( [:db_condition_placeholder_0] => 0 [:languages_und] => und [:languages_en-gb] => en-gb ) in HeartbeatStream->executeQuery() (line 607 of /var/www/html/example/sites/all/modules/hearbeat/includes/heartbeatstream.inc).
The problem is that the language placeholder for en-gb contains the "-" and it seems that this character is not allowed.
How to reproduce:
- install a clean drupal 7 instance (or use an existing one) and the latest version of the hearbeat module
- enabled for example the "singleactivity" hearbeat block block and put it in the main content.
- add a language that has a "-" in the code (like en-gb, en-US, etc..)
- visit the page that contains the heartbeat block with the language you added before.
The patch that solves this issue will be added in the next comment.
Comment | File | Size | Author |
---|---|---|---|
#1 | heartbeat_language_issue_1439590_1.patch | 564 bytes | vasi1186 |
Comments
Comment #1
vasi1186 CreditAttribution: vasi1186 commentedAttached a patch that should solve this issue.
Comment #2
Stalski CreditAttribution: Stalski commentedPatch is pretty straight forward. No comments.
I just pushed this to git.