Undefined index #states when viewing form

Created on 4 April 2022, over 2 years ago
Updated 10 August 2023, over 1 year ago

Problem/Motivation

Undefined index: #states in
Drupal\webform_views\Plugin\views\filter\WebformSubmission
NumericFilter->valueForm() (line 86 of
/home/public_html/web/modules/contrib/webform_views

Steps to reproduce

This prevents any forms from being displayed.

Notice: Undefined index: #states in Drupal\webform_views\Plugin\views\filter\WebformSubmissionNumericFilter->valueForm() (line 86 of /home//public_html/web/modules/contrib/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php)

#0 /home//public_html/web/core/includes/bootstrap.inc(346): _drupal_error_handler_real(8, 'Undefined index...', '/home//...', 86)
#1 /home//public_html/web/modules/contrib/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php(86): _drupal_error_handler(8, 'Undefined index...', '/home//...', 86, Array)
#2 /home//public_html/web/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php(937): Drupal\webform_views\Plugin\views\filter\WebformSubmissionNumericFilter->valueForm(Array, Object(Drupal\Core\Form\FormState))
#3 /home//public_html/web/core/modules/views/src/Form/ViewsExposedForm.php(111): Drupal\views\Plugin\views\filter\FilterPluginBase->buildExposedForm(Array, Object(Drupal\Core\Form\FormState))
#4 [internal function]: Drupal\views\Form\ViewsExposedForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#5 /home//public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(531): call_user_func_array(Array, Array)
#6 /home//public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(278): Drupal\Core\Form\FormBuilder->retrieveForm('views_exposed_f...', Object(Drupal\Core\Form\FormState))
#7 /home//public_html/web/core/modules/views/src/Plugin/views/exposed_form/ExposedFormPluginBase.php(134): Drupal\Core\Form\FormBuilder->buildForm('\\Drupal\\views\\F...', Object(Drupal\Core\Form\FormState))
#8 /home//public_html/web/core/modules/views/src/ViewExecutable.php(1238): Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase->renderExposedForm()
#9 /home//public_html/web/core/modules/views/src/ViewExecutable.php(1391): Drupal\views\ViewExecutable->build(NULL)
#10 /home//public_html/web/core/modules/views/src/ViewExecutable.php(1454): Drupal\views\ViewExecutable->execute(NULL)
#11 /home//public_html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2460): Drupal\views\ViewExecutable->render()
#12 /home//public_html/web/core/modules/views/src/ViewExecutable.php(1662): Drupal\views\Plugin\views\display\DisplayPluginBase->preview()
#13 /home//public_html/web/core/modules/views_ui/src/ViewUI.php(602): Drupal\views\ViewExecutable->preview('page_2', Array)
#14 /home//public_html/web/core/modules/views_ui/src/ViewPreviewForm.php(62): Drupal\views_ui\ViewUI->renderPreview('page_2', Array)
#15 /home//public_html/web/core/lib/Drupal/Core/Entity/EntityForm.php(106): Drupal\views_ui\ViewPreviewForm->form(Array, Object(Drupal\Core\Form\FormState))
#16 /home//public_html/web/core/modules/views_ui/src/ViewFormBase.php(41): Drupal\Core\Entity\EntityForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
#17 [internal function]: Drupal\views_ui\ViewFormBase->buildForm(Array, Object(Drupal\Core\Form\FormState), 'page_2')
#18 /home//public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(531): call_user_func_array(Array, Array)
#19 /home//public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(370): Drupal\Core
πŸ› Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tjtj

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France MaxPah

    Hello,

    Here is a patch that corrects the log.

  • Status changed to RTBC over 1 year ago
  • I get this error, too. I've been using 5.1, and I was never using an older version, as I'm working on a new site.

    Warning: Undefined array key "#states" in Drupal\webform_views\Plugin\views\filter\WebformSubmissionNumericFilter->valueForm() (line 86 of /var/www/html/web/modules/contrib/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php)
    #0 /var/www/html/web/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', '/var/www/html/w...', 86)
    #1 /var/www/html/web/modules/contrib/webform_views/src/Plugin/views/filter/WebformSubmissionNumericFilter.php(86): _drupal_error_handler(2, 'Undefined array...', '/var/www/html/w...', 86)
    #2 /var/www/html/web/core/modules/views/src/Plugin/views/filter/FilterPluginBase.php(943): Drupal\webform_views\Plugin\views\filter\WebformSubmissionNumericFilter->valueForm(Array, Object(Drupal\Core\Form\FormState))
    #3 /var/www/html/web/core/modules/views/src/Form/ViewsExposedForm.php(111): Drupal\views\Plugin\views\filter\FilterPluginBase->buildExposedForm(Array, Object(Drupal\Core\Form\FormState))
    #4 [internal function]: Drupal\views\Form\ViewsExposedForm->buildForm(Array, Object(Drupal\Core\Form\FormState))
    #5 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array(Array, Array)
    

    The patch works, but it could probably use $element['#states'] ?? NULL, since PHP 7+ is required by Drupal 9.

  • Status changed to Fixed over 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia VladimirAus Brisbane, Australia

    Thank you! Committed! 🍻

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024