Imporssible to submit a form without JavaScript on Drupal 9.5

Created on 8 March 2023, about 2 years ago

Problem/Motivation

Our test suit picked up that it is impossible to submit a form without JavaScript with Drupal 9.5. Specifically it was tested with Drupal 9.5.2 , Media bulk upload 3.0.0 and PHP 8.0.

Tests are Behat driven and running using Goutte. Passing with no issues on Drupal 9.4.10.

Steps to reproduce

  Scenario: Upload media document via bulk upload interface
    Given I am logged in as a user with the "Content Manager" role
    And a "media_collection" term with the name "test-media-collection"
    And a "publication_set" term with the name "test-publication-set"
    And a "tags" term with the name "test-tag"
    When I am on "/media/bulk-upload"
    Then I should see the link "Document"
    When I click "Document" in the "Admin Content" region
    Then I am at "/media/bulk-upload/bulk_upload_document"
    And I should see "csv, doc, docx, pdf, pps, ppsx, ppt, pptx, rtf, txt, xls, xlsx, zip"
    And I attach the file "documents/test.docx" to "File Upload"
    And I enter "2030-06-30" for "Date"
    And I select "All Rights Reserved" from "Copyright licence"
    And I select "test-media-collection" from "Media collection (value 1)"
    And I select "test-publication-set" from "Publication set (value 1)"
    And I select "test-tag" from "Tags (value 1)"
    And I enter "Bulk upload" for "Revision log message"
    And I press "Submit"
    # Init batch.
    And I reload the page
    # Process batch.
    And I reload the page
    Then the following "document" media exist:
      | name      | field_media_collection | field_publication_set | field_copyright_license | field_document_date | field_tags |
      | test.docx | test-media-collection           | test-publication-set           | All Rights Reserved              | 2030-06-30T12:00:00+12:00    | test-tag   |
    # Clean up.
    Then no document media:
      | name      |
      | test.docx |
    And no managed files:
      | filename  |
      | test.docx |
The website encountered an unexpected error. Please try again later.<br><br><em class="placeholder">Exception</em>: Serialization of &#039;Symfony\Component\HttpFoundation\File\UploadedFile&#039; is not allowed in <em class="placeholder">serialize()</em> (line <em class="placeholder">89</em> of <em class="placeholder">core/lib/Drupal/Core/Queue/DatabaseQueue.php</em>). <pre class="backtrace">Drupal\Core\Queue\DatabaseQueue-&gt;doCreateItem(Array) (Line: 68)
Drupal\Core\Queue\DatabaseQueue-&gt;createItem(Array) (Line: 1001)
_batch_populate_queue(Array, 0) (Line: 907)
batch_process() (Line: 63)
Drupal\Core\Form\FormSubmitter-&gt;doSubmitForm(Array, Object) (Line: 595)
Drupal\Core\Form\FormBuilder-&gt;processForm(&#039;media_bulk_upload_form&#039;, Array, Object) (Line: 323)
Drupal\Core\Form\FormBuilder-&gt;buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController-&gt;getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 168)
Drupal\purge_queuer_url\StackMiddleware\UrlRegistrar-&gt;handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 134)
Drupal\cloudflare\CloudFlareMiddleware-&gt;handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 713)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

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

Comments & Activities

  • Issue created by @RoSk0
  • Status changed to Postponed: needs info about 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    I just tested with Drupal 9.5.7 and PHP 8.1.13 and 8.x-2.x which is the same codebase as 3.0.x. Are you still having this issue?

  • Status changed to Closed: works as designed almost 2 years ago
  • πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

    Not an issue any more.

  • Status changed to Active almost 2 years ago
  • πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

    Sorry, missed the JavaScript tag on the test...

    Unfortunately this is still the problem. I was able to replicate it on the bare Drupal core 9.5.3 plus this module version 3.0.2 manually.

    Steps to reproduce:

    • create a "Document" upload configuration that will accept "Document" media with "Default" form
    • navigate to the form
    • disable JavaScript in your browser
    • attach a single file
    • click "Save"
    • observe "Exception: Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed in serialize() (line 89 of core/lib/Drupal/Core/Queue/DatabaseQueue.php)."
  • Status changed to Postponed: needs info about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States Kristen Pol Santa Cruz, CA, USA

    Thanks for the details. Given that D9 is EOL, this needs to be checked on D10.4 to see if it's an issue there.

Production build 0.71.5 2024