Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have Message and Commerce Message installed and working fine. However, on our dev site, when trying to run cron, it throws this error and stops cron from finishing:
PHP Fatal error: Unsupported operand types in /home/devel/public_html/sites/all/modules/message/message.module on line 295
That line and the function is:
// Gather purgeable messages of overriding types.
foreach ($override_types as $message_type) {
// Ignore message type with unchecked "Purge messages". Also make sure that
// purging settings are present.
if (empty($message_type->data['purge']) || empty($message_type->data['purge']['enabled'])) {
continue;
}
$purge_messages += message_get_purgeable_by_type($purge_limit, $message_type->name, $message_type->data['purge']); //Line 295
}
I think this might be caused by checking "Override" and "Purge Messages", but not putting anything in the field. In that case, it does not return an array.
function message_get_purgeable_by_type(&$purge_limit, $message_type_name, $purge_settings) {
if ($purge_limit <= 0) {
return;
}
...
..
If you change it to:
function message_get_purgeable_by_type(&$purge_limit, $message_type_name, $purge_settings) {
if ($purge_limit <= 0) {
return array();
}
...
..
It seems to work fine.
Comment | File | Size | Author |
---|---|---|---|
#2 | fix-cron-purge-messages-error-2030101-2.patch | 391 bytes | antondavidsen |
Comments
Comment #1
amitaibuHow about a patch? :)
Comment #2
antondavidsen CreditAttribution: antondavidsen commentedPatch against 1.9
Comment #3
amitaibuCorrect status and version.
Comment #4
joelpittetThat seams reasonable in #2 if we are to union the array we better expect the operands to be as much.
Comment #5
Delphine Lepers CreditAttribution: Delphine Lepers at Trasys for European Commission and European Union Institutions, Agencies and Bodies commentedAny chance to get this patch included in the next release?
Comment #6
jonhy81 CreditAttribution: jonhy81 commented+1 to include this patch in the next release.
Comment #7
nikolabintev CreditAttribution: nikolabintev commented#2 works for me. It fixes the issue. Please commit it to the next release
Comment #8
bluegeek9 CreditAttribution: bluegeek9 as a volunteer commented