Ultimate cron on Drupal 7 generates excessive notices/warnings.

e.g.
Deprecated function: Creation of dynamic property UltimateCronGeneralSettings::$type is deprecated in UltimateCronPlugin->__construct() (line 39 of /var/www/html/biblioottawalibrary/web/sites/all/modules/contrib/ultimate_cron/ultimate_cron.plugin.inc).
Deprecated function: Creation of dynamic property UltimateCronGeneralSettings::$key is deprecated in UltimateCronPlugin->__construct() (line 40 of /var/www/html/biblioottawalibrary/web/sites/all/modules/contrib/ultimate_cron/ultimate_cron.plugin.inc).

Comments

classiccut created an issue. See original summary.

classiccut’s picture

Patch that explicitly declares type and key as public member properties.

narkoff’s picture

Had same issue. Patch resolved warnings.

crawleyde’s picture

This solves many deprecated function warnings for me as well. Thank you.

  • arnested committed c88b325b on 7.x-2.x
    Issue #3489049 by classiccut: Prevent excessive warnings with php 8.2
    
arnested’s picture

Status: Active » Fixed

Thank you for the patch!

It has been committed and released in the 7.x-2.10 release.

classiccut’s picture

Amazing! Thanks for the quick turnaround. Much appreciated.

arnested’s picture

A good patch makes a difference 🥰

narkoff’s picture

Even after adding this patch, I still have the following message in my logs:

Deprecated function: Creation of dynamic property UltimateCronJob::$sort is deprecated in ultimate_cron_run_launchers() (line 1643 of /code/sites/all/modules/ultimate_cron/ultimate_cron.module).

Should this patch have addressed this too?

arnested’s picture

StatusFileSize
new396 bytes

Probably, @narkoff.

Does this patch work?

narkoff’s picture

Thank you, @arnested.

Yes, patch in #10 works. But I noticed I was also getting messages for $disabled, $hook, $table, $description, $title, $export_type, $name, $jid, $type, $progress, $lock_id, $log_entry. Adding these to class UltimateCronJob worked.

Or, the other option is to add #[\AllowDynamicProperties] in front of the class (though I assume explicitly defining all dynamic properties is better).

arnested’s picture

Status: Fixed » Needs work

Yes, I think adding the properties are the way forward.

On the other hand, Drupal 7 is soon too be unsupported. So I think both approaches are valid now.

Would you mind creating a patch?

I'm not using Drupal 7 anymore myself, so I would just end up blindly adding what you suggest anyway :)

arnested’s picture

Status: Needs work » Needs review
StatusFileSize
new560 bytes

Maybe a combination?

This patch declares the properties that are actually used in the class itself.

And then it declares AllowDynamicProperties for all the other properties to not emit warnings.

narkoff’s picture

StatusFileSize
new982 bytes

This adds all properties that were generating messages to the UltimateCronJob and CropRule classes.

  • arnested committed 700340c8 on 7.x-2.x
    Issue #3489049 by narkoff: Prevent excessive warnings with php 8.2
    
arnested’s picture

Status: Needs review » Fixed

Thank you for the patch, @narkoff.

I have committed it and released it as version 7.x-2.11.

Status: Fixed » Closed (fixed)

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