anewman1980’s picture

I receive nearly the same error in 7.x-1.x-dev

Notice: Undefined property: stdClass::$mail in comment_notify_comment_insert() (line 263 of /comment_notify/comment_notify.module).

The issue seems to occur whenever an email address for the anonymous user is not set, even if an email address is not requested. It happens whether the permission to allow anonymous users to subscribe is set or not. The only way around this currently is to force the anonymous user to provide an email address, which is probably not the best solution (this is done in content type settings).

sirkitree’s picture

seeing this as well. verified that actually putting in an email address fixes this. Note that this also happens even if you do not check the "Notify me when new comments are posted" box.

nicoz’s picture

Title: After posting anonymus comment, I receive an error. » After posting anonymous comment, I receive an error.
JohnAlbin’s picture

Title: After posting anonymous comment, I receive an error. » PHP notice when anonymous email address not required
greggles’s picture

So, this module used to use the mail and the cid as the basis of the hash. But those are not always available. I was using them basically for legacy reasons, but I don't think there's any reason to do that.

So, two patches: one that still uses the mail as the basis still but uses a brand new password (which seemed like a decent thing...) otherwise.

One that just uses a brand new password.

Thoughts? Should I use something other than a random password?

greggles’s picture

Status: Active » Needs review

This should ideally get a backport.

Dave Reid’s picture

Hrm, I know $comment->hostname is always available, but it may not necessarily be unique. Maybe add in $comment->created?

greggles’s picture

Status: Needs review » Fixed
960 bytes

Great, that works for me. It's not super unique but the cid is pretty unique.

Jiri Volf’s picture

Tried the patched version from git and also dev version from 20.7, and when submitted a comment(checked notify and provided an email address) - got Notice: Undefined property: stdClass::$hostname on 259

tried inserting token [comment:hostname] in the email form in comment notify settings - and when posted a new commnent to the same thread, it did not show up in the email and I got:

Notice: Undefined property: stdClass::$hostname ve funkci comment_tokens() (řádek: 131 v souboru /data/web/virtuals/1198/virtual/www/modules/comment/

When I tried other tokens in the email template - like [comment:cid] or [comment:created] - it got replaced correctly appeared in the incomming email.

I am still on drupal 7.0, not sure it this could be the problem.. Once i update it, will try again. I am using the latest token 7.x-1.0-beta2

update: changed my username from vlx to Jiri Volf

greggles’s picture

Thanks for the information vlx. I couldn't repeat that behavior myself, I wonder if you have a slightly different configuration somewhere? My site is a pretty basic Drupal 7 installation.

greggles’s picture

For now let's move the discussion on the issue in #9 to #1224958: Notice: Trying to get property of non-object line 418 comment_notify.module.

jec006’s picture

I've updated the patch to make it work with drush (for the purpose of using it in a make file)


#fail, posted the wrong one... trying again

jec006’s picture

greggles’s picture

The comment in #9 that claimed this was a problem referred to a separate issue -

In that separate issue he says he upgraded to 7.4 and the problem is gone, so perhaps this was a problem with earlier versions of core?

I feel more confident in this now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.