Getting Recoverable fatal error when webform_id is invalid.

I'm getting this error when I mistyped the webform id value:

The website encountered an unexpected error. Please try again later.<br /><em class="placeholder">Recoverable fatal error</em>: Argument 1 passed to Drupal\webform\WebformSubmissionForm::isOpen() must implement interface Drupal\webform\WebformInterface, null given,

Perhaps the module should provide a validation for a valid webform object before proceeding with using it.

Comments

mqanneh created an issue. See original summary.

mqanneh’s picture

Assigned: mqanneh » Unassigned
Status: Active » Needs review
StatusFileSize
new1.18 KB
mqanneh’s picture

Since we are not concerned about cacheability metadata here, I updated the patch to return ResourceResponse instead of ModifiedResourceResponse.

mqanneh’s picture

imclean’s picture

#3 This is intentional. Other actions, such as sending an email, requires cache metadata to be added. I'm not sure what this would be which is why it returns a ModifiedResourceResponse.

See: #2899161: Submitting a Webform which has an email handler results in a 500 error

mqanneh’s picture

@imclean
ok. so I'll rewrite my patch to use ModifiedResourceResponse but we still need this patch to validate that we have a valid webform id. the module only checks that it's not an empty value for the webform id which is not enough.

what do you think?

check patch #2

mqanneh’s picture

imclean’s picture

Looks good, thank you.

  • imclean committed 69cb360 on 8.x-1.x authored by mqanneh
    Issue #2930702 by mqanneh: Getting Recoverable fatal error when...
imclean’s picture

Status: Needs review » Fixed
mqanneh’s picture

Status: Fixed » Closed (fixed)