I have a multistep webform on my D8 Website. When I click "next" on the first page, I get the notice which I paste below:
Notice: Uninitialized string offset: 0 in Drupal\Core\Render\Element::property() (line 27 of /var/www/html/core/lib/Drupal/Core/Render/Element.php)
#0 /var/www/html/core/includes/bootstrap.inc(566): _drupal_error_handler_real(8, 'Uninitialized s...', '/var/www/html/t...', 27, Array)
#1 /var/www/html/core/lib/Drupal/Core/Render/Element.php(27): _drupal_error_handler(8, 'Uninitialized s...', '/var/www/html/t...', 27, Array)
#2 /var/www/html/modules/webform/src/WebformSubmissionConditionsValidator.php(347): Drupal\Core\Render\Element::property('')
#3 /var/www/html/modules/webform/src/WebformSubmissionConditionsValidator.php(333): Drupal\webform\WebformSubmissionConditionsValidator->getVisibleElementsRecusive(Array, Array)
#4 /var/www/html/modules/webform/src/WebformSubmissionConditionsValidator.php(144): Drupal\webform\WebformSubmissionConditionsValidator->getVisibleElements(Array)
#5 /var/www/html/modules/webform/src/WebformSubmissionForm.php(1085): Drupal\webform\WebformSubmissionConditionsValidator->validateForm(Array, Object(Drupal\Core\Form\FormState))
#6 [internal function]: Drupal\webform\WebformSubmissionForm->validateForm(Array, Object(Drupal\Core\Form\FormState))
#7 /var/www/html/core/lib/Drupal/Core/Form/FormValidator.php(83): call_user_func_array(Array, Array)
#8 /var/www/html/core/lib/Drupal/Core/Form/FormValidator.php(270): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState))
#9 /var/www/html/core/lib/Drupal/Core/Form/FormValidator.php(119): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'webform_submiss...')
#10 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(571): Drupal\Core\Form\FormValidator->validateForm('webform_submiss...', Array, Object(Drupal\Core\Form\FormState))
#11 /var/www/html/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('webform_submiss...', Array, Object(Drupal\Core\Form\FormState))
#12 /var/www/html/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm('webform_submiss...', Object(Drupal\Core\Form\FormState))
#13 /var/www/html/modules/webform/src/Entity/Webform.php(986): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\webform\Entity\WebformSubmission), 'add')
#14 /var/www/html/modules/webform/src/Controller/WebformController.php(83): Drupal\webform\Entity\Webform->getSubmissionForm()
#15 [internal function]: Drupal\webform\Controller\WebformController->addForm(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\webform\Entity\Webform))
#16 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#17 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#19 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#20 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(144): call_user_func_array(Object(Closure), Array)
#22 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#23 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#27 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#28 /var/www/html/modules/devel/webprofiler/src/StackMiddleware/WebprofilerMiddleware.php(38): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#29 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#30 /var/www/html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#31 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#32 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#33 {main}.
Comments
Comment #2
jrockowitz commentedI can't reproduce this error using the Example: Wizard (/form/example-wizard).
Please isolate the problem using basic webform, export it, and upload it here.
Comment #3
orkutmuratyilmazI've created a new multi page webform and I got the notice when I clicked on "next page" again. The export of my new webform is below:
Comment #4
jrockowitz commentedThanks for the example. I can't reproduce the issue locally using the Bartik theme.
The
Notice: Uninitialized string offset: 0usually indicates there is empty property on a element.Are you able to replicate the issue via clean install on https://simplytest.me/?
Comment #5
orkutmuratyilmazI switched back to 8.x-5.0-beta16 and the notice is disappeared now.
Comment #6
jrockowitz commentedComment #7
orkutmuratyilmazThis notice came back, when I updated to 8.x-5.0-beta18. So I downgraded back to 8.x-5.0-beta16.
I'm still looking for a solution, because I'd like to keep my web app updated.
Comment #8
orkutmuratyilmazComment #9
jrockowitz commented@Orkut Murat Yılmaz.
Are you able to reproduce the error using https://simplytest.me?
Are you using any modules or themes that could be altering your webforms? Try disabling these modules
Comment #10
jrockowitz commentedComment #11
jrockowitz commentedClosing because no one has responded with more information.
Comment #12
bogdan.racz commentedI have the same problem.
I wasn't able to find the real issue, but I noticed that somehow in the
WebformSubmissionConditionsValidatorclass, in thevalidateFormRecursivemethod, one of the keys in the form array is empty, so theElement::property($key)triggers the notice.I added an extra empty check for the key, see the patch bellow.
Comment #13
bogdan.racz commentedComment #15
bogdan.racz commentedComment #16
jrockowitz commentedThe failing test most likely has to do with
empty($key)is seeing a '0' array index as empty.I am not sure the attached patch will work.
Comment #18
jrockowitz commentedI committed the attached patch. Please download the latest dev release to review.