Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When accessing admin/content and using the delete multiple action, this error happens:
( ! ) Fatal error: Call to a member function has() on a non-object in /webs/contrib/drupal8/core/lib/Drupal/Core/Form/ConfirmFormBase.php on line 51
We need to add tests showing the failure and fix the buildForm method by adding the request to it
Comment | File | Size | Author |
---|---|---|---|
#20 | drupal-2049569-15.patch | 5.08 KB | tonytroy |
#19 | drupal-2049569-15.patch | 5.08 KB | tonytroy |
#14 | interdiff.txt | 2.27 KB | pcambra |
#14 | drupal-2049569-14.patch | 5.08 KB | pcambra |
#11 | interdiff.txt | 2.9 KB | pcambra |
Comments
Comment #1
dawehnerThis seemed to be not the only place.
Comment #2
tim.plunkettComment #3
pcambraRemoved the part from TranslatableForm as that one needs a deeper fix (everything seems to be broken in that file), I'll open a followup for that one and check with the D8MI guys
Here's a fix for the nodes one with tests, the interdiff is the test file that should not pass the tests plus the removal of the translatable form bit.
Comment #4
pcambraHere's the related issue #2050359: Fix TranslatableForm in content translation
Comment #5
tim.plunkettBeautiful. Great work @pcambra!
Comment #6
dawehnerNice test coverage!
Shouldn't we use the EntityNG way of accessing the data?
Comment #7
pcambraNow with moar entityNG :))
Comment #8
tim.plunkettWorks for me.
Comment #9
BerdirThis shouldn't need the == ... part. isSticky() returns boolean, this only works because of the == condition. Same for a bunch of those isSticky() and isPromoted() below.
I think an assertNull($node) makes more sense here, checking a node is "empty" feels strange.
Comment #10
BerdirAlso, definition nitpick.. using methods has nothing to do with NG, the whole point of it is to hide that there's NG below it ;)
Comment #11
pcambraThanks for the comments Berdir, this should fix #9
Comment #12
dawehnerThank you berdir for the review.
The points of berdir seems to be adressed.
Comment #13
alexpottI think we need a message here as the default message is not going to be helpful. I think the message will be "Value FALSE is TRUE." :)
Comment #14
pcambraAddressed #13
Comment #15
jibranBack to RTBC
Comment #16
webchickThis fix looks good for this one page, and the tests look great. Although, it looks like the root problem derives from the fact that the Request parameter on ConfirmFormBase::buildForm() is optional, despite the fact that it's actually not:
...so when
return parent::buildForm($form, $form_state);
happens, boom.So let's get a follow-up filed to either remove the "= NULL" part of that function signature, or else actually make it optional.
In the meantime, committed and pushed to 8.x. Thanks!
Comment #17
tim.plunkettOpened #2054991: Forms often require the request, but buildForm() does not enforce that as a follow-up.
Comment #19
tonytroy CreditAttribution: tonytroy commentedI had he same problem but the patch drupal-2049569-14.patch didn't work for me (it generated an error) so i add a little modification and now it works fine !
Hope it can help.
Comment #20
tonytroy CreditAttribution: tonytroy commentedI had he same problem but the patch drupal-2049569-14.patch didn't work for me (it generated an error) so i add a little modification and now it works fine !
Hope it can help.
Comment #21
jibran@tonytroy Please create a new issue. Describe the new bug and post your patch there. After #16 the patch is the part of drupal core now you have to post the new changes in new issue. Thank you for your help.