Impossible to submit a form without JavaScript on Drupal 9.5

Created on 8 March 2023, over 1 year ago
Updated 8 May 2023, about 1 year 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

Manual

  • 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)."

Behat:

@api
Feature: "Content Manager" CMS role
  In order to confirm platform configuration
  As a "Content Manager"
  I need to verify expected functionality

  Scenario: Upload media document via bulk upload interface
    Given I am logged in as a user with the "administer media_bulk_upload configuration" permission
    And I am on "/admin/config/media/media-bulk-config/add"
    And I fill in "Label" with "Document"
    And I fill in "Machine-readable name" with "document"
    And I fill in "Upload location" with "temp://bulk_upload/document/"
    And I check the box "Document"
    And I select "Default" from "Form Mode"
    And I press "Save"
    And the cache has been cleared
    Given I am logged in as a user with the "use document bulk upload form" permission
    When I am on "/media/bulk-upload"
    Then I am at "/media/bulk-upload/document"
    And I attach the file "documents/test.docx" to "File Upload"
    And I press "Submit"
    Then the following "document" media exist:
      | name      |
      | 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 1 year 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 about 1 year ago
  • πŸ‡³πŸ‡ΏNew Zealand RoSk0 Wellington

    Not an issue any more.

  • Status changed to Active about 1 year 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)."
Production build 0.69.0 2024