- Issue created by @uridrupal
- 🇮🇳India abhishek_virasat
Hello @UriDrupal, Could you please provide more information about the error, including the specific file and function where it is occurring? Additionally, please provide steps to reproduce the error, and specify which actions lead to this error.
Thank you. - 🇪🇸Spain uridrupal
I was using a hook_cron with a service inside. When I ran the hook_cron through simple_cron I got this error.
The error was in src/CronJobManager.php/** * {@inheritdoc} */ public function getEnabledJob(string $job_id): ?CronJobInterface { $jobs = $this->cronJobStorage->loadByProperties([ 'id' => $job_id, 'status' => TRUE, ]); return $jobs ? reset($jobs) : NULL; }
I couldn't figure out what was I doing wrong. Tried both the hook_cron way and the Plugin way, nothing worked. I am pretty sure it must have been something with my code, because the other jobs were working fine, but my hook_cron was just this:
function hook_cron() { \Drupal::service('my_service')->myMethod(); }
- Assigned to abhishek_virasat
- Issue was unassigned.
- Status changed to Needs review
6 months ago 5:39am 4 July 2024 - 🇮🇳India abhishek_virasat
@UriDrupal, I have fixed the issue and created MR. please review it once.
- Status changed to RTBC
about 1 month ago 4:58pm 18 November 2024 - 🇬🇧United Kingdom scott_euser
Certainly doesn't hurt to be more protective in the code like this.
-
scott_euser →
committed 7f82b091 on 1.1.x authored by
abhishek_gupta1 →
Issue #3457018 by abhishek_gupta1: reset(): Argument #1 ($array) must be...
-
scott_euser →
committed 7f82b091 on 1.1.x authored by
abhishek_gupta1 →