Hi

When visiting the Elysia Cron settings page, these errors show up:

Notice: Undefined index: rule in _elysia_cron_next_run() (line 32 of /PATH/sites/all/modules/elysia_cron/elysia_cron_scheduler.inc).
Notice: Undefined index: rule in _elysia_cron_next_run() (line 33 of /PATH/sites/all/modules/elysia_cron/elysia_cron_scheduler.inc).

And also an 'Invalid rule' entry in watchdog has been produced.

These messages are being caused when a channel row is encountered while processing the elysia_cron table as they don't have a 'rule' index specified in their $conf array.

This can be fixed by implementing a preliminary check to see if $conf['rule'] is set (line 33):

Original

  if (!preg_match('/^([0-9*,\/-]+)[ ]+([0-9*,\/-]+)[ ]+([0-9*,\/-]+)[ ]+([0-9*,\/-]+)[ ]+([0-9*,\/-]+)$/', $conf['rule'], $rules)) {
    elysia_cron_warning('Invalid rule found: %rule', array('%rule' => $conf['rule']));
    return false;
  }

Fixed:

  if(!isset($conf['rule'])) {
    return false;
  }
  elseif (!preg_match('/^([0-9*,\/-]+)[ ]+([0-9*,\/-]+)[ ]+([0-9*,\/-]+)[ ]+([0-9*,\/-]+)[ ]+([0-9*,\/-]+)$/', $conf['rule'], $rules)) {
    elysia_cron_warning('Invalid rule found: %rule', array('%rule' => $conf['rule']));
    return false;
  }

Patch will follow.

- Propaganistas

CommentFileSizeAuthor
#1 elysia_cron-rule-error-1984890-1.patch751 bytesAnonymous (not verified)

Comments

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new751 bytes

Patch

gotheric’s picture

Assigned: Unassigned » gotheric
Status: Needs review » Fixed

Committed fix in dev version, thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.