Problem/Motivation
On the submissions page (/admin/structure/webform/manage/webform_id/results/submissions), deleting submissions fails with the error
The submitted value <em class="placeholder">280</em> in the <em class="placeholder">items</em> element is not allowed.
Steps to reproduce
- Create a webform with many submissions, for example 1000.
- Use the customize button to move the “locked” column to the very left.
- Sort by this column.
- Now, the error above appears every time I check a checkbox in front of a submission in the table, pick “Delete submission” from the select and press the “Apply to selected items” button.
The order of rows in the table has changed. I can also see this in the debugger, e.g. in \Drupal\Core\Form\FormValidator::performRequiredValidation, when I look at the keys of the $options variable before the $form_state->setError() call.
I am using MariaDB v11.0.2.
Proposed resolution
Add the sid as a second order column as a fallback.
Remaining tasks
Review patch or suggest a different resolution.
User interface changes
None.
API changes
None.
Data model changes
None.
Comments
Comment #2
gogowitsch commentedHere is a stack trace from the debugger:
Drupal\Core\Form\FormErrorHandler->displayErrorMessages(Array, Object) (Line: 23) Drupal\Core\Form\FormErrorHandler->handleFormErrors(Array, Object) (Line: 199) Drupal\Core\Form\FormValidator->finalizeValidation(Array, Object, 'webform_submission_bulk_form') (Line: 119) Drupal\Core\Form\FormValidator->validateForm('webform_submission_bulk_form', Array, Object) (Line: 593) Drupal\Core\Form\FormBuilder->processForm('webform_submission_bulk_form', Array, Object) (Line: 325) Drupal\Core\Form\FormBuilder->buildForm('\Drupal\webform\Form\WebformSubmissionBulkForm', Object) (Line: 224) Drupal\Core\Form\FormBuilder->getForm('\Drupal\webform\Form\WebformSubmissionBulkForm', Array, 1) (Line: 577) Drupal\webform\WebformSubmissionListBuilder->buildEntityList() (Line: 462) Drupal\webform\WebformSubmissionListBuilder->render() (Line: 23) Drupal\Core\Entity\Controller\EntityListController->listing('webform_submission') call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627) 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: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) 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: 28) Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32) Drupal\big_pipe\StackMiddleware\ContentLength->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: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)Comment #3
gogowitsch commentedI added a patch.
Comment #4
jrockowitz commentedComment #5
jrockowitz commentedI can't replicate this issue
Comment #6
gogowitsch commentedThanks, @jrockowitz, for trying to reproduce this. It turns out that sorting is important to produce this problem. I have updated the steps above.
Here is a recording.
Comment #7
jrockowitz commentedComment #8
jrockowitz commentedThat video is really helpful. I am baffled to the root cause of that specific warning.
I am able to reproduce this
Comment #10
jrockowitz commented@gogowitsch Thank you for catching that issue. I have seen similar issues when performing bulk operations with views, and it looks like you found the perfect solution—always append sorting by 'id' to ensure the record order is reliable.
Moving to RTBC with the assumption that all the tests will pass.
Comment #11
jrockowitz commentedA few tests broke but I still think this is the right solution.
Comment #12
gogowitsch commentedEDIT: I wrote this comment after just reading the email notication on #8 - and what I wrote has become obsolete by your work. So please ignore this comment - I can’t find a way to delete it.
Comment #13
gogowitsch commentedThe current code in the PR throws an error in the CI:
The CI uses MySQL v8.0.43, whereas locally I use MariaDB v11.5.2. I’ll attempt to reproduce it locally using MySQL.
Comment #15
jrockowitz commented