When someone post a new comment, everything seems to work just fine (the mail is sent and the comment is successfully added) but I've got these two PHP errors at the same timestamp in the log messages :
First :
Notice: Undefined index: name in _comment_notify_mailalert() (line 417 of /var/www/mysite.com/sites/all/modules/comment_notify/comment_notify.module).
Second :
Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of /var/www/mysite.com/sites/all/modules/comment_notify/comment_notify.module).
I wonder if this is important or to be skipped ?
Thank you,
Aurelien
Comment | File | Size | Author |
---|---|---|---|
#17 | 974338-node-notify-mailalert-17.patch | 739 bytes | bricel |
#5 | 974338_comment_notify_indefined_index.patch | 771 bytes | tobby |
Comments
Comment #1
VladGh CreditAttribution: VladGh commentedSame here, with 7.x-1.x-dev. But I only get the second error:
Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of /srv/www/vladgh.com/sites/all/modules/comment_notify/comment_notify.module).
Comment #2
VladGh CreditAttribution: VladGh commentedRegarding the second error:
Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of /srv/www/vladgh.com/sites/all/modules/comment_notify/comment_notify.module).
I discovered that the "user_load" function on line 438
does not include a variable called "node_notify_mailalert" but it includes an array called "comment_notify_settings" with the following content:
- uid (String, 1 characters ) 1
- node_notify (String, 1 characters ) 1
- comment_notify (String, 1 characters ) 1
So, by changing "$author->node_notify_mailalert == 1" in line 440 with "$author->comment_notify_settings->node_notify == 1" everything seems to work. I am not sure though it this is the right way to do this.
Comment #3
tsvenson CreditAttribution: tsvenson commentedI got the two same errors as in the original post for comments to forum posts in Drupal 7 RC3.
How to reproduce:
- Create a new forum topic
- Create a new comment to the above topic
In my case I had notification turned of for the user in both of the posts above.
Also changing version to -dev since that is the version I used.
Comment #4
caschbre CreditAttribution: caschbre commentedI'm also experiencing the same as #2. Trying to suggested workaround.
Comment #5
tobby CreditAttribution: tobby commentedI've created a patch from #2, which worked for me.
Comment #6
Frickelpiet CreditAttribution: Frickelpiet commentedFor me this solved the second problem, but I still get the first error message:
Notice: Undefined index: name in _comment_notify_mailalert() (Zeile 417 von /var/www/vhosts/mysite.com/subdomains/test/httpdocs/sites/all/modules/comment_notify/comment_notify.module).
Comment #7
nightmaar CreditAttribution: nightmaar commentedConfirm this, i've got the same first message as a topic starter when posting a comment on new D7.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedsubscribing
Comment #9
vitok-dupe CreditAttribution: vitok-dupe commentedsame. sub.
Comment #10
madeby CreditAttribution: madeby commentedI also get:
Notice: Undefined index: name in _comment_notify_mailalert() (line 417 of /sites/all/modules/comment_notify/comment_notify.module).
After I have posted a comment.
Comment #11
FrequenceBanane CreditAttribution: FrequenceBanane commentedsubscribe
Comment #12
DeweyOxberger CreditAttribution: DeweyOxberger commentedFor the Feb 25 dev version I'm getting this:
Comment #13
caschbre CreditAttribution: caschbre commentedI'm getting the same error in #12.
Comment #14
codeforkjeff CreditAttribution: codeforkjeff commentedFWIW, the patch in #5 applied to the feb25 dev version worked for me. That should go into git.
(I'm working with a new D7 installation, not upgraded from D6.)
I haven't seen the error about the undefined "name" index. There IS a name field in the comment object, and I also tested some debug output statements to verify that it's there. Maybe it only happens under certain conditions?
Comment #15
codeforkjeff CreditAttribution: codeforkjeff commentedI've been testing and creating patches for this module for D7, since I really need it to work asap.
I've attached patches to relevant bug tickets here on the drupal website, but if anyone wants to pull down my forked version from github, it's publicly available here:
https://github.com/codeforkjeff/comment_notify
Comment #16
David_Rothstein CreditAttribution: David_Rothstein commentedIn the future, if you mark issues "needs review" when there is a patch, people will probably review them faster :)
The important part of this bug is not the PHP notice, but rather the fact that the node author never gets the email (even when they checked the "Receive node follow-up notification e-mails" box on their user account page). Retitling, and also marking a couple other issues duplicate (since we have a working patch here), including:
#833452: Notification not sent for 1st comment, only replies
#1157692: Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 433
#1184280: Bug in node author handling in _comment_notify_mailalert()
I'm not sure if the module maintainer wants a test written here, but otherwise I think the patch is RTBC - it works and the code makes sense. (Actually, looking at the patch I don't think the
$author->comment_notify_settings->node_notify == 1
check is really necessary when there was a!empty()
check right before it, but on the other hand, that's exactly what the D6 version of the module does, so might as well keep it around.)Comment #17
bricel CreditAttribution: bricel commented> Looking at the patch I don't think the $author->comment_notify_settings->node_notify == 1 check is really necessary when there was a !empty() check right before it
Re-rolled patch accordingly.
Comment #18
David_Rothstein CreditAttribution: David_Rothstein commentedThanks, that patch works too. Either one is RTBC, from my point of view :)
Comment #19
gregglesThe patches are the same :)
Now committed http://drupalcode.org/project/comment_notify.git/commit/b646247
Thanks tobby, bricel, David_Rothstein!
Comment #21
moonray CreditAttribution: moonray commentedStill getting the following error. I double checked, this patch is in place.
Notice: Undefined property: stdClass::$node_notify_mailalert in _comment_notify_mailalert() (line 440 of comment_notify/comment_notify.module).
Comment #22
moonray CreditAttribution: moonray commentedHrm, never mind.