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.

CommentFileSizeAuthor
#1 heartbeat_language_issue_1439590_1.patch564 bytesvasi1186
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vasi1186’s picture

Status: Active » Needs review
FileSize
564 bytes

Attached a patch that should solve this issue.

Stalski’s picture

Status: Needs review » Closed (fixed)

Patch is pretty straight forward. No comments.
I just pushed this to git.