This is the original error:
Notice: Undefined index: nodecc in mass_contact_mail_page_submit() (line 437 of /var/www/.../mass_contact.page.inc.
I was able to track it down to around line 360 of mass_contact.page.inc. On the surface, this looks wrong (the same code is duplicated right above):
$form['nodecc'] = array(
'#type' => 'hidden',
'#default_value' => variable_get('mass_contact_nodecc_d', 1),
);
$form['nodecc'] = array(
'#type' => 'item',
'#title' => t('Archive a copy of this message on this website'),
'#markup' => t('A copy of this message will !not be archived on this website.',
array('!not' => variable_get('mass_contact_nodecc_d', 1) ? '' : 'not')),
);
The second $form['nodecc'] overwrites the first one. I got rid of the notice by removing the second assignment.
But... if it did work, it looks to me like it would allow an unprivileged user to 'view source' on the page, and modify the form to create a node? The permission check should prevent the creation of the node somewhere along that code path, not just prevent the output of some HTML that a sneaky user could easily generate himself.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | mass_contact-nodecc-1423224.patch | 3.32 KB | orlitzky |
Comments
Comment #1
orlitzky commentedHere's a quick patch that seems to work, tested for about 30 seconds =)
Comment #2
oadaeh commentedThank you for discovering that bug and researching it. On the surface, I would only have put a check for an empty variable at 437, and I would have totally missed the duplicate field naming.
Your observation as to the potential problems and fixes are, however, incorrect. The correct fix is to rename the second field, which I have done and committed to the dev release, here: http://drupalcode.org/project/mass_contact.git/commit/6d41cbd
That first field is hidden at the Drupal/PHP level, not at the HTML level. If you would have viewed the source of your own page, you would have seen that.
Also, eliminating that second field eliminates the notice to the user that a copy of their message will be archived on the site.
Comment #4
orlitzky commented(I should have replied earlier, but I just opened my account and didn't realize I wouldn't be notified of issue activity.)
Thanks for the fix; I really don't know much about the forms API so I thought it would be better to mention it and be wrong than not. I'll take a closer look on the site I'm developing to see what really happens.
Comment #5
oadaeh commentedYou should automatically be notified of any issue you create or comment on, unless you later unfollow the issue.