Found an error when using it with php 7.1

Error: Unsupported operand types in UltimateCronQueueSettings->cron_alter() (line 188 of /modules/contrib/ultimate_cron/plugins/ultimate_cron/settings/queue.class.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

david.lopez created an issue. See original summary.

david.lopez’s picture

Patch attached for review

joelstein’s picture

Status: Active » Needs work

I encountered this same bug, but after patching it I now see this warning (which is better than an error):

Creating default object from empty value queue.class.php:189

arnested’s picture

Thank you for the patch, david.lopez, and thank you for the review, joelstein.

I think this indicates we have to find a root cause of the none existing $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings.

AlexKirienko’s picture

We faced similar issue from time to time on deployment.
We have a lot of features and use CI for deployment which revert features.

Fixed with command
drush rr

Patch #1 was applied. I will test it for a while.

alexdmccabe’s picture

Status: Needs work » Needs review
FileSize
1.21 KB
1.21 KB

I think this indicates we have to find a root cause of the none existing $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings.

I think it might be because it was never defined anywhere in the first place. I'm using version 7.x-2.8:

$ grep -Rn "ultimate_cron_plugin_settings_queue_cleanup" *
plugins/ultimate_cron/settings/queue.class.php:160:      unset($jobs['ultimate_cron_plugin_settings_queue_cleanup']);
plugins/ultimate_cron/settings/queue.class.php:188:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings += array(
plugins/ultimate_cron/settings/queue.class.php:191:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler'] += array(
plugins/ultimate_cron/settings/queue.class.php:195:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler']['crontab'] += array(
plugins/ultimate_cron/settings/queue.class.php:198:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler']['simple'] += array(

Digging through the git history with git grep "ultimate_cron_plugin_settings_queue_cleanup" $(git rev-list --all) gives me pretty much the same story:

bcb0d93001dd04f3b1c62ed31536e651697cb538:plugins/ultimate_cron/settings/queue.class.php:      unset($jobs['ultimate_cron_plugin_settings_queue_cleanup']);
bcb0d93001dd04f3b1c62ed31536e651697cb538:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings += array(
bcb0d93001dd04f3b1c62ed31536e651697cb538:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler'] += array(
bcb0d93001dd04f3b1c62ed31536e651697cb538:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler']['crontab'] += array(
bcb0d93001dd04f3b1c62ed31536e651697cb538:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler']['simple'] += array(
a0fbf9d1e98f8341b23eb17b90e915472f52c8e2:plugins/ultimate_cron/settings/queue.class.php:      unset($jobs['ultimate_cron_plugin_settings_queue_cleanup']);
a0fbf9d1e98f8341b23eb17b90e915472f52c8e2:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings += array(
a0fbf9d1e98f8341b23eb17b90e915472f52c8e2:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler'] += array(
a0fbf9d1e98f8341b23eb17b90e915472f52c8e2:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler']['crontab'] += array(
a0fbf9d1e98f8341b23eb17b90e915472f52c8e2:plugins/ultimate_cron/settings/queue.class.php:    $jobs['ultimate_cron_plugin_settings_queue_cleanup']->settings['scheduler']['simple'] += array(

That's just the first two commits, but it's the same all the way down the list.

What was this job originally supposed to do? It seems like it was never fully fleshed out in the first place. Would it be simpler to just remove it, since it can't possibly be working anyway?

Patch to make that change attached, but I'm not sure what to make of the if statement at the beginning of the method. Should it also be removed?