Undefined array key "#timezone" warning

Created on 8 October 2023, about 1 year ago
Updated 9 October 2023, about 1 year ago

I used the date list field in the web form, but I encountered the following error when displaying the form.

Warning: Undefined array key "#timezone" in Drupal\calendar_systems\Element\CalendarSystemsDateList::processDatelist() (line 124 of modules/contrib/calendar_systems/src/Element/CalendarSystemsDateList.php).

Drupal\calendar_systems\Element\CalendarSystemsDateList::processDatelist(Array, Object, Array)
call_user_func_array(Array, Array) (Line: 1012)
Drupal\Core\Form\FormBuilder->doBuildForm('webform_submission_register_add_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('webform_submission_register_add_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('webform_submission_register_add_form', Array, Object) (Line: 1075)
Drupal\Core\Form\FormBuilder->doBuildForm('webform_submission_register_add_form', Array, Object) (Line: 579)
Drupal\Core\Form\FormBuilder->processForm('webform_submission_register_add_form', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'add') (Line: 1257)
Drupal\webform\Entity\Webform->getSubmissionForm() (Line: 77)
Drupal\webform\Controller\WebformEntityController->addForm(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
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: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

---------------------------------------------------------------
In the file modules/contrib/calendar_systems/src/Element/CalendarSystemsDateList.php
In line 124, I encountered an index call from the array that does not exist ('#date_timezone').

$cal = _calendar_systems_factory($element['#timezone'], 'en');

While the array stores this value in the index '#date_timezone' and the above code can be changed like this.

$cal = _calendar_systems_factory($element['#date_timezone'], 'en');

it's worked for me.

🐛 Bug report
Status

Closed: won't fix

Version

3.6

Component

Code

Created by

🇮🇷Iran amir jamshidi

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @amir jamshidi
  • Thanks for reporting this.

    I had many issues with webform. I'll try to address timezone element thingy with your fix and see if any other issue pops up or not!

  • Status changed to Closed: won't fix about 1 year ago
  • Ah I missed the fact that it's version 8.x we're talking about :D. Unfortunately no development goes into the 8.x branch, only the 4.x (for Drupal 10) is maintained.

Production build 0.71.5 2024