Notice: Undefined index: weight in CRM_Core_Action::{closure}()
Overview
The dblog is filling up with errors with this message:
Notice: Undefined index: weight in CRM_Core_Action::{closure}() (line 317 of /mysite/modules/contrib/civicrm/CRM/Core/Action.php).
Reproduction steps
I can reproduce this on my site by visiting any contact tab (not just 1195):
https://mysite.org/civicrm/contact/view?reset=1&cid=1195&selectedChild=mailing
Current behaviour
The dblog fills up with something like 20 (the number varies) instances of a PHP notice:
Message: Notice: Undefined index: weight in CRM_Core_Action::{closure}() (line 317 of /mysite/modules/contrib/civicrm/CRM/Core/Action.php).
Referrer: https://mysite.org/civicrm/contact/view?reset=1&cid=1195&selectedChild=mailing
Expected behaviour
No dblog entries.
Environment information
- Browser: Safari (Desktop)
- CiviCRM: 5.67.0
- PHP: 7.4.31
- CMS: Backdrop 1.26.1
Comments
The relevant code is:
usort($seqLinks, static function ($a, $b) {
return (int) ((int) ($a['weight']) > (int) ($b['weight']));
});
Seems like it should perhaps be
usort($seqLinks, static function ($a, $b) {
return (int) ((int) ($a['weight'] ?? 0) > (int) ($b['weight'] ?? 0));
});