Closed (fixed)
Project:
Mass Contact
Version:
8.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 May 2017 at 11:53 UTC
Updated:
16 Jul 2020 at 06:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
mvogel commentedComment #3
sukanya.ramakrishnan commented@mvogel,
I couldnt replicate this issue. tried with multiple number of categories (including zero).
Recently, category was made optional for sending a mass contact message. Quite a few changes were made relating to it. Please try using the latest dev version and let us know if the error still exists.
Thanks,
Sukanya
Comment #4
raman.b commentedTo replicate the issue, go to Mass Contact Settings Form (/admin/config/mass-contact/settings), change the 'Field to use to display the categories' to 'Check boxes'. Then send mass email using /mass-contact without any categories selected and 'Send yourself a copy' as checked. Following error is logged:
Error: Call to a member function label() on null in Drupal\mass_contact\Form\MassContactMessageConfirmForm->buildForm() (line 138 of /var/www/html/drupal/modules/mass_contact/src/Form/MassContactMessageConfirmForm.php) #0 [internal function]: Drupal\mass_contact\Form\MassContactMessageConfirmForm->buildForm(Array, Object(Drupal\Core\Form\FormState))Comment #5
raman.b commentedComment #6
sukanya.ramakrishnan commentedThanks for the patch. I see that the expressions
array_filter($form_state->getValue('categories')is being repeated. Can we put this in a local variable instead?Thanks,
Sukanya
Comment #7
sukanya.ramakrishnan commentedAlso, since this error was not caught by tests, looks like we are missing test coverage. Patch with a test would be great!
Comment #9
gaurav.kapoor commentedLet's pick test cases in seperate issue.
Comment #10
gaurav.kapoor commentedMy bad. Pushed this by mistake. @ramanbatra1709 can you add the correct patch?
Comment #11
manishsaharan commentedIssue Fixed. Need Approval
Comment #12
manishsaharan commentedComment #13
sukanya.ramakrishnan commentedHmm, both patches submitted are different. @manishsaharan29497 Did u mean to combine both patches ?
I would really like test coverage on this fix . Will try to work on it this weekend. Thanks!
Thanks,
Sukanya
Comment #14
gnugetWe found this bug in one of our projects today and we created #3125825: Fatal error when a category isn't selected (!?!) while debugging it, glad to see that this was already reported.
I address the comment at #6 and I modified a bit one of the tests to use the checkboxes instead of the select so this can be indeed tested.
New patch attached.
Comment #16
mlncn commentedWe've been using this successfully for more than a month now.
Comment #18
gaurav.kapoor commentedThanks, everyone for working on this.