Problem
The current plugin, WebformSubmissionDevelGenerate, is not compatible with the DevelGenerateBase plugin base of the Devel module, version 5.2 or higher.
Steps to reproduce
1. Update the devel module to version ^5.2
2. Try to submit a webform
3. Get the error as below
Fatal error: Type of Drupal\webform\Plugin\DevelGenerate\WebformSubmissionDevelGenerate::$entityTypeManager must be Drupal\Core\Entity\EntityTypeManagerInterface (as in class Drupal\devel_generate\DevelGenerateBase) in /var/www/html/abc/web/modules/webform/src/Plugin/DevelGenerate/WebformSubmissionDevelGenerate.php on line 30
Proposed resolution
1. Prohibit the use of Devel module versions higher than 5.2 with the current Webform version.
2. Update the WebformSubmissionDevelGenerate in accordance with DevelGenerateBase.
| Comment | File | Size | Author |
|---|---|---|---|
| #37 | fix_incompatibility_issue_for_6_3_x.patch | 921 bytes | yovince |
| #27 | fix_incompatibility_with_devel_5.2.patch | 30.8 KB | gg24 |
Issue fork webform-3435903
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
cilefen commentedIs that the precise type error or have you edited the text? I've not seen "as in class" before.
Comment #3
cilefen commentedAlso please give the exact versions of Webform and of Devel and list the versions that changed when you, as you put it, migrated. Did you migrate or upgrade?
Comment #4
Mahendar00279 commentedThank you for your response Cilefen,
I encountered an issue after upgrading from Drupal 10.1 to 10.2.4. I'm using Devel 5.2.1 and Webform 6.2.2.
Reverted back Devel 5.0 then working fine.
thank you.
Comment #5
taraskorpachI've faced the issue as well. It seems like the 'Devel' maintainers have changed a lot of code in the DevelGenerateBase, while the WebformSubmissionDevelGenerate plugin extends it. Look on the commit.
Webform 6.2.2
Devel 5.2.1
Comment #6
taraskorpachComment #7
taraskorpachComment #8
cilefen commentedNo code is posted so I am setting this to "Active" status.
Comment #11
jrockowitz commentedThe MR attempts to support devel 5.2 and 5.1.
Comment #12
gaddman commentedTested MR#429 and resolves the issue OK for me. I haven't deployed this into a production site, this is just a few basic tests using the email handler (since I didn't experience any problem without this).
Comment #13
gaddman commentedA workaround is to uninstall the Devel Generate module (so long as that's not going to impact other functions of your site).
Comment #14
jrockowitz commentedComment #15
pandaski commentedWe encountered this issue today while trying to update the Devel module to version 5.2.1 from 5.1.2.
We are using Drupal core 10.1.8 and Webform 6.2.2.
Comment #16
taraskorpach#12 says that the issue is solved with the MR. Setting RTBC because of this.
Comment #17
jrockowitz commentedWe need to confirm that the MR does NOT break older versions of the devel module.
Comment #18
seoulpanda20 commentedConfirming that I'm also running into this problem. I receive a 500 PHP Fatal error on form submission.
Versions:
PHP Fatal error on form-submission:
PHP Fatal error: Type of Drupal\\webform\\Plugin\\DevelGenerate\\WebformSubmissionDevelGenerate::$entityTypeManager must be Drupal\\Core\\Entity\\EntityTypeManagerInterface (as in class Drupal\\devel_generate\\DevelGenerateBase) in /var/www/html/www.example.com/web/modules/contrib/webform/src/Plugin/DevelGenerate/WebformSubmissionDevelGenerate.phpFrustrating but glad I came across this thread!
Thanks for your hard work all these years, @jrockowitz.
Comment #19
mscieszka commentedI can confirm that after installing a fresh Webform 6.2.x and applying the patch from the MR, I can submit the default contact form without the WSOD that occurred when using Devel 5.2.1. Also, after downgrading to 5.1.2 and applying the patch, the form submits correctly.
Comment #20
ricovandevin commentedI can confirm that the patch resolves the issue for Webform 6.2.2 and Devel 5.2.1. Also, things still work after disabling Devel Generate (which should generally be done for production websites).
Comment #21
ipumpkinConfirmed patch with Webform 6.2.2 and Devel 5.1.2
Comment #22
inversed commentedConfirmed here as well. Either disabling Devel Generate or the patch, both solutions work with Webform 6.2.2 and Devel 5.1.2.
Comment #24
liam morlandRebased
I noticed that the merge request removes the
$entityTypeManagerproperty but it leaves$messenger, which is also provided by the parent class. Is there a reason for this?Comment #25
jrockowitz commentedTo rely on the base classes dependencies, we might need to change
$instance = new static($configuration, $plugin_id, $plugin_definition);- to -
$instance = parent::create($container, $configuration, $plugin_id, $plugin_definition);Comment #26
liam morlandI have made the change suggested in #25. I don't see how it could have worked without this change so full review that this code is working is needed.
A test should be added which visits path
admin/config/development/generate/webform. That would have caught the problem withcreate().Comment #27
gg24 commentedI see that a commit for 10.3 is being added in the same patch where we are handling the issue for dev module incompatibility. IMHO this should have been handled in the separate issue.
Hence, I am re-rolling a patch for 10.2 Drupal version.
Thanks!
Comment #28
liam morlandThe Drupal 10.3 commit was added by accident. I have removed it by rebasing.
Comment #29
liam morlandComment #31
idebr commentedThis issue was fixed as part of #3465838: Drupal 11 compatibility fixes for webform
It can probably be closed as a duplicate
Comment #32
liam morlandComment #34
cb_govcms commentedWhile this was fixed in #3465838: Drupal 11 compatibility fixes for webform it looks like that only made it to the 6.3 branch. Can we get this into 6.2 please?
Comment #35
liam morland6.2.x receives only security support and critical bug fixes. It will be EOL very soon.
Comment #36
liam morlandThe fix is probably just removing
protected $entityTypeManager;insrc/Plugin/DevelGenerate/WebformSubmissionDevelGenerate.php. That way, it uses the declaration of this property from its parent class.This is simple enough. Feel free to create a merge request.
Comment #37
yovincewebform 6.3.x works fine and seems to fix the issue, but it introduces another minor compatibility issue.
Comment #38
liam morlandPlease put your change into a merge request.
Comment #41
liam morland6.2.x receives only security support and critical bug fixes. @chrisolof your merge request looks like it does more than just what is required to fix an incompatibility with
devel. There needs to be an explanation of why the change is needed.Comment #42
chrisolofUnderstood - feel free to close the MR, unless you feel that this represents a critical bug fix for the 6.2.x branch. It will still serve as a patch source that cleanly applies for those on webform 6.2.x who wish to use devel ^5.2. I think a lot of us are still on 6.2.x while 6.3.x moves toward a stable release.
Correct - apparently I fixed one incorrect return type while I was in there and I am pretty certain this one change is not strictly necessary for devel ^5.2 compatibility:
https://git.drupalcode.org/project/webform/-/merge_requests/860/diffs?co...
Given that this MR may never actually get merged, I'm going to leave this small fix in the MR for now. If you do want to merge this MR and do not want this change, it can be easily reverted prior to merge (and I would be happy to do that - but anyone with branch access can do it also).
Beyond that I am not trying to do anything other than fix the incompatibility with devel ^5.2 in MR 860. I believe I just branched off of 6.2.x, cherry-picked from MR 429 right up to the point 6.3.x was merged into it (see 429 commits vs 860 commits), then fixed that one incorrect return type while I was right in front of it.
If you look at how devel's DevelGenerateBase changed from 5.1.2 to 5.2.0 and compare that with the diff in MR 860, I think you'll find it all lines up.
I believe WebformEntityStorageTrait had to be removed due to it being incompatible with the new DevelGenerateBase, specifically with regard to WebformEntityStorageTrait's declaration of
protected $entityTypeManager;and DevelGenerateBase's declaration ofprotected EntityTypeManagerInterface $entityTypeManager;, and that is why you find WebformEntityStorageTrait's methods repeated in here, as I believe they are all utilized in WebformSubmissionDevelGenerate.I can confirm that in my project, MR 860 (in patch form) applies cleanly against webform 6.2.x and resolves this bug (which was critical in my project).