Problem/Motivation
We are getting this when update the module from version 8.1.11 to 8.1.19. Actually from 8.1.16 to up, it gives fatal error for office hours field.
#0 web\core\lib\Drupal\Component\Serialization\PhpSerialize.php(21): unserialize(Array)
#1 web\modules\contrib\office_hours\src\Plugin\WebformElement\WebformOfficeHours.php(423): Drupal\Component\Serialization\PhpSerialize::decode(Array)
#2 web\modules\contrib\office_hours\src\Plugin\WebformElement\WebformOfficeHours.php(373): Drupal\office_hours\Plugin\WebformElement\WebformOfficeHours->unserialize(Array, Array, Object(Drupal\webform\Entity\WebformSubmission))
#3 web\modules\contrib\office_hours\src\Plugin\WebformElement\WebformOfficeHours.php(148): Drupal\office_hours\Plugin\WebformElement\WebformOfficeHours->getItemsUnserialized(Array, Object(Drupal\webform\Entity\WebformSubmission))
#4 web\modules\contrib\webform\src\Plugin\WebformElementManager.php(173): Drupal\office_hours\Plugin\WebformElement\WebformOfficeHours->prepare(Array, Object(Drupal\webform\Entity\WebformSubmission))
#5 web\modules\contrib\webform\src\WebformSubmissionForm.php(2594): Drupal\webform\Plugin\WebformElementManager->buildElement(Array, Array, Object(Drupal\Core\Form\FormState))
#6 web\modules\contrib\webform\src\WebformSubmissionForm.php(2601): Drupal\webform\WebformSubmissionForm->prepareElements(Array, Array, Object(Drupal\Core\Form\FormState))
#7 web\modules\contrib\webform\src\WebformSubmissionForm.php(835): Drupal\webform\WebformSubmissionForm->prepareElements(Array, Array, Object(Drupal\Core\Form\FormState))
#8 web\core\lib\Drupal\Core\Entity\EntityForm.php(107): Drupal\webform\WebformSubmissionForm->form(Array, Object(Drupal\Core\Form\FormState))
#9 web\modules\contrib\webform\src\WebformSubmissionForm.php(648): Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#10 [internal function]: Drupal\webform\WebformSubmissionForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#11 web\core\lib\Drupal\Core\Form\FormBuilder.php(536): call_user_func_array(Array, Array)
#12 web\core\lib\Drupal\Core\Form\FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm('webform_submiss...', Object(Drupal\Core\Form\FormState))
#13 web\core\lib\Drupal\Core\Form\FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm('webform_submiss...', Object(Drupal\Core\Form\FormState), Array)
#14 web\core\lib\Drupal\Core\Form\FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm('webform_submiss...', Array, Object(Drupal\Core\Form\FormState))
#15 web\core\lib\Drupal\Core\Entity\EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\webform\WebformSubmissionForm), Object(Drupal\Core\Form\FormState))
#16 web\modules\contrib\webform\src\Entity\Webform.php(1250): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\webform\Entity\WebformSubmission), 'add')
#17 web\modules\contrib\webform\src\Controller\WebformEntityController.php(89): Drupal\webform\Entity\Webform->getSubmissionForm()
#18 [internal function]: Drupal\webform\Controller\WebformEntityController->addForm(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\webform\Entity\Webform))
#19 web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#20 web\core\lib\Drupal\Core\Render\Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#22 web\core\lib\Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#23 vendor\symfony\http-kernel\HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#24 vendor\symfony\http-kernel\HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#25 web\core\lib\Drupal\Core\StackMiddleware\Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 web\core\lib\Drupal\Core\StackMiddleware\KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 web\core\lib\Drupal\Core\StackMiddleware\ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 web\core\modules\big_pipe\src\StackMiddleware\ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 web\core\modules\page_cache\src\StackMiddleware\PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 web\core\modules\page_cache\src\StackMiddleware\PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 web\core\lib\Drupal\Core\StackMiddleware\ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 web\core\lib\Drupal\Core\StackMiddleware\NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#33 web\core\lib\Drupal\Core\StackMiddleware\AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#34 web\core\lib\Drupal\Core\StackMiddleware\StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#35 web\core\lib\Drupal\Core\DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#36 web\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#37 {main}
In addition to that, it gives two warnings
Warning: Undefined array key "#webform_key" in Drupal\office_hours\Plugin\WebformElement\WebformOfficeHours->prepare() (line 153 of web\modules\contrib\office_hours\src\Plugin\WebformElement\WebformOfficeHours.php)
Warning: Undefined array key "value" in Drupal\office_hours\Plugin\WebformElement\WebformOfficeHours->prepare() (line 153 of web\modules\contrib\office_hours\src\Plugin\WebformElement\WebformOfficeHours.php)
Steps to reproduce
Just install the module from version 8.1.16 to 8.1.19 and add the office hours field to any webform, try fill up the fields and submit, you will get that.