diff --git a/core/lib/Drupal/Core/Form/FormCache.php b/core/lib/Drupal/Core/Form/FormCache.php index b1b278f..3b7f706 100644 --- a/core/lib/Drupal/Core/Form/FormCache.php +++ b/core/lib/Drupal/Core/Form/FormCache.php @@ -153,7 +153,7 @@ public function getCache($form_build_id, FormStateInterface $form_state) { */ protected function loadCachedFormState($form_build_id, FormStateInterface $form_state) { $session = $this->requestStack->getCurrentRequest()->getSession(); - if ($session->has('form_state:' . $form_build_id) && $session_form_state = $session->get('form_state:' . $form_build_id)) { + if ($session->has('form_state:' . $form_build_id) && $session_form_state = unserialize($session->get('form_state:' . $form_build_id))) { if ($session_form_state['expires'] < $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME')) { return; } @@ -218,10 +218,10 @@ public function setCache($form_build_id, $form, FormStateInterface $form_state) if ($data = $form_state->getCacheableArray()) { $session = $this->requestStack->getCurrentRequest()->getSession(); - $session->set('form_state:' . $form_build_id, [ + $session->set('form_state:' . $form_build_id, serialize([ 'expires' => $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME') + $expire, 'data' => $data, - ]); + ])); } } @@ -231,6 +231,8 @@ public function setCache($form_build_id, $form, FormStateInterface $form_state) public function deleteCache($form_build_id) { $this->keyValueExpirableFactory->get('form')->delete($form_build_id); $this->keyValueExpirableFactory->get('form_state')->delete($form_build_id); + $session = $this->requestStack->getMasterRequest()->getSession(); + $session->remove('form_state:' . $form_build_id); } } diff --git a/index.php b/index.php index 53392f9..3202bac 100644 --- a/index.php +++ b/index.php @@ -8,6 +8,7 @@ * See COPYRIGHT.txt and LICENSE.txt files in the "core" directory. */ +ini_set('display_errors', 1); use Drupal\Core\DrupalKernel; use Drupal\Core\Site\Settings; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;