Hi @yuriseki,
I have successfully created a scheduled task using the action: Schedule a task to delete a node with a specific nid.
However, when I try to manually 'execute' the action from /admin/config/workflow/business_rules/schedule/execute/2, the below error is generated on a white dead screen:
Fatal error: Drupal\business_rules\Controller\ScheduleController::execute(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "Drupal\business_rules\Events\BusinessRulesEvent" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in \web\modules\contrib\business_rules\src\Controller\ScheduleController.php on line 135
Thank you,
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | incomplete_class-3043803-7.patch | 628 bytes | deciphered |
| #5 | business_rules-3043803-Execute-a-scheduled-task-returns-Fatal-error-5.patch | 1.22 KB | yseki |
Comments
Comment #2
c.e.a commentedComment #3
manfye commentedso what is the solution?
Comment #4
colanUpdating status as there's no code here. Also, this is definitely not critical as the module works fine if not using tasks.
Patches welcome as this isn't currently affecting any of the maintainers.
Comment #5
yseki commentedIt was using an object that could be empty.
Here's a patch.
Comment #7
decipheredSo this patch doesn't seem to resolve the issue for me. And from what I can tell, this patch doesn't resolve the underlying issue of the Incomplete class.
Simple enough fix, as per https://stackoverflow.com/questions/965611/forcing-access-to-php-incompl... Serializing and unserialzing the object resolves the issue (for me).
Patch attached.
Comment #8
GavZav commentedThe website encountered an unexpected error. Please try again later.
Error: Call to a member function getSubject() on boolean in Drupal\business_rules\Entity\Schedule::executeSchedule() (line 424 of modules/contrib/business_rules/src/Entity/Schedule.php).
Drupal\business_rules\Entity\Schedule::executeSchedule(Object) (Line: 481)
business_rules_cron()
call_user_func_array('business_rules_cron', Array) (Line: 392)
Drupal\Core\Extension\ModuleHandler->invoke('business_rules', 'cron') (Line: 236)
Drupal\Core\Cron->invokeCronHandlers() (Line: 134)
Drupal\Core\Cron->run() (Line: 75)
Drupal\Core\ProxyClass\Cron->run() (Line: 271)
Drupal\admin_toolbar_tools\Controller\ToolbarController->runCron()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)