Form build caching is broken in Drupal 11

Created on 29 July 2025, about 21 hours ago

Problem/Motivation

In Drupal 11, Webform $form builds seem to be sharing cache between users which is causing issues when users should be able to submit 1 submission per user for each.

Steps to reproduce

1. Spin up a new Drupal 11.1.x test site - (Using 11.2.2)
2. Install Webform 6.3.x - (Using 6.3.0-beta3)
3. Enable the dynamic_page_cache module
4. Create a Webform "Test Webform", can just be a single checkbox field.
5. Under the webforms Settings -> Submissions, set Submission limit settings -> Per user -> Per user submission limit to be 1
6. Under the webforms Settings -> Access, untick "Anonymous User"

So now we've got a Webform that requires you to be logged in, but each user can only submit the webform once.

Now create 2 users, User A and User B.

1. User A logs in and accesses the Webform, at endpoint /form/test-webform
2. After submitting, User A goes back to the page /form/test-webform, and correctly sees the text "No more submissions are permitted."
3. User A logs out
4. User B logs in, and accesses /form/test-webform
5. User B now incorrectly sees the text "No more submissions are permitted.", even though they have never submitted this webform.
6. If you clear the cache with drush cr, User B will be able to see the correct form.

Interestingly, if you then log back in with User A, they'll correctly be blocked again, but then if you go back in with User B, they will now also be blocked from submitting again.

It seems like both users are sharing this same cached version of the form, even though they should see very different $form builds.

If I have some time I will try and write this into a test case. From my testing this doesn't affect Drupal 10.x.

🐛 Bug report
Status

Active

Version

6.3

Component

Code

Created by

🇦🇺Australia thomwilhelm Sydney

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

Comments & Activities

Production build 0.71.5 2024