Problem/Motivation
Error occurs when visiting an event instance URL
InvalidArgumentException: The date cannot be created from a format. in Drupal\Component\Datetime\DateTimePlus::createFromFormat() (line 253 of core/lib/Drupal/Component/Datetime/DateTimePlus.php).
Drupal\recurring_events_registration\RegistrationCreationService->registrationOpeningClosingTime() (Line: 541)
Drupal\recurring_events_registration\RegistrationCreationService->registrationIsOpen() (Line: 497)
recurring_events_registration_eventinstance_view(Array, Object, Object, 'full')
call_user_func_array('recurring_events_registration_eventinstance_view', Array) (Line: 403)
Drupal\Core\Extension\ModuleHandler->invokeAll('eventinstance_view', Array) (Line: 288)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 239)
Drupal\Core\Entity\EntityViewBuilder->build(Array)
call_user_func_array(Array, Array) (Line: 101)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 786)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 377)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 578)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->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: 717)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Possibly related to https://www.drupal.org/project/recurring_events/issues/3228781 as showing same error
Steps to reproduce
Create an event series with registration enabled and set to:
Registration Type = Entire Series Registration
Registration Date = Scheduled Registration
Registration Opens = some date and time
Registration Closes = some date and time
Comments
Comment #2
chrisla commentedComment #3
owenbush commentedThanks for the issue, I'll take a look soon.
Comment #4
chrisla commentedRegistrationCreationService->registrationOpeningClosingTime() at line 600 is returning an empty array when used in RegistrationCreationService->registrationIsOpen() line 541
getRegistrationDateRange() for same event was returning
so that should be okay because
$value['value']is thereah, I see... this code in getRegistrationDateRange() is wrong in this case. the $value array (see above) has a 0 key and so the $date_range array is not getting set:
Comment #5
chrisla commentederased tag by mistake
Comment #6
chrisla commentedthis appears to be the only instance of getRegistrationDateRange used in the module
this patch solves the problem of getRegistrationDateRange() returning an empty array and works as long as the Registration Closes field is not empty
should Registration Closes be required when filling out the Scheduled Registration start and end dates and times? if not, we need to add some more checks to account for that value being empty
Comment #7
chrisla commentedComment #10
owenbush commentedThank you for the patch, this has been merged into the latest dev branches.