Create a new webform where the anonymous user has permission to submit. Set the "Total Submissions Limit" to be 1 ever. Visit the webform as the anonymous user and fill in. After submitting, if you revisit the webform, the webform title appears with no content and no messages are displayed. This occurs whether or not the page in question is cached.

The cause appears to be in the logic applied when trying to avoid invalidating the cache on a cached page.

In webform_node_view(), line 1949 checks whether the page is cacheable using drupal_page_is_cacheable(): if it is possible to cache the page, this function returns TRUE to a $cached variable whether or not the page actually is cached.

Line 1972 sets the $enabled variable to FALSE if the total webform submissions limit has been reached, ignoring the $cached variable. In theme_webform_view_messages, line 2152 checks whether the $cached variable is FALSE before setting the message to tell the user why the webform is disabled. This means that the anonymous user receives an empty webform and no message explaining why whether or not the page actually is cached.

This can be rectified by removing the check against the $cached variable before setting the message. However, as the total submission limit is a constant for all site visitors, this would mean the empty form could never be cached even though it won't change. It might make more sense to make the message about a form being disabled because the total submission limit has been reached part of the page content (and therefore cacheable) rather than a Drupal message (and hence not cacheable).

It might also be worth reconsidering the use of drupal_page_is_cacheable(), as this isn't a reliable method of identifying if a page actually is cached. As a minimum, any time the webform is disabled (and invisible) something should be shown to the user to explain why.

Comments

MrDaleSmith created an issue. See original summary.

mrdalesmith’s picture

Patch in case anyone needs a quick fix.

mrdalesmith’s picture

liam morland’s picture

Status: Active » Needs review
reszli’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch solved the issue for me

liam morland’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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