I've just installed comment_notify, and so far when it sends an email the email goes through no problem but it also throws a php error that says:

Notice: Undefined property: stdClass::$node_type in entity_extract_ids() (line 7379 of /public_html/includes/common.inc).

The function in common.inc it is referring to is (line 7379 is the bold one):

function entity_extract_ids($entity_type, $entity) {
$info = entity_get_info($entity_type);
// Objects being created might not have id/vid yet.
$id = isset($entity->{$info['entity keys']['id']}) ? $entity->{$info['entity keys']['id']} : NULL;
$vid = ($info['entity keys']['revision'] && isset($entity->{$info['entity keys']['revision']})) ? $entity->{$info['entity keys']['revision']} : NULL;
// If no bundle key provided, then we assume a single bundle, named after the
// entity type.
$bundle = $info['entity keys']['bundle'] ? $entity->{$info['entity keys']['bundle']} : $entity_type;
return array($id, $vid, $bundle);
}

Obviously I'm glad that the emails are being sent, but the php error is of course less than ideal. Any ideas?

Comments

I don't see this error on a default installation. I wonder if it's actually related to token generation somehow.

Status:Active» Postponed (maintainer needs more info)

better status.

Same issue for me:
Notice : Undefined property: stdClass::$node_type dans entity_extract_ids() (ligne 7379 dans /homez.467/bridgena/www/includes/common.inc).Notice : Undefined index: comment_node_poll dans _token_field_info() (ligne 1209 dans /homez.467/bridgena/www/sites/all/modules/token/token.tokens.inc).

Any idea?

Status:Postponed (maintainer needs more info)» Active

I would be this is associated with tokens because we don't actually load complete comment objects via comment_load() or comment_load_multiple() - we load an incomplete object. We should be adding comment_notify data via hook_comment_load() rather than writing our own load functions.

Same issue for me, mail sent but error message shows up. My installation is pretty standard I only have 5 more contributed modules on top of core Drupal 7 install. Everything is up to date.

Backup and Migrate
Backup and Migrate Files (dev)
Comment notify
Pathauto
Token

Any idea?
Claudio

we load an incomplete object.

I don't think that's the case. $comment comes from the various hook_comment_{blah} so those should really work with token.

We should be adding comment_notify data via hook_comment_load() rather than writing our own load functions.

Again, I'm not sure what you mean here. Maybe post a patch with at least theory of what you're talking about?

The problem is that $watchers = comment_notify_get_watchers($nid); which loops through $watchers and fires off a comment notification (using $watcher as a token data object) are not complete comment objects but should be. Patch is incoming.

Version:7.x-1.0-beta1» 7.x-1.x-dev
Status:Active» Needs work
StatusFileSize
new4.28 KB

Partial patch that at least shows where the problem is and how we start fixing it.

Title:Undefined property: stdClass::$node_type in entity_extract_ids() Remove some internal helper functions, add data to comment_load, fully load comments before alerting

I'll have to think on this approach some more and I'd like to wait a bit to get feedback from other people (hence a new title).

I think we could make the symptom go away by adding a little more data to our query, which would probably work pretty well.

My concerns are that I'm not sure it makes sense to add the comment_notify data in during every comment_load. I also wonder how well this scales (e.g. on a site with hundreds of comments on a node).

I do think it's the right way to go, but it has some cons we should consider.

subscribe

I'm getting tons of such messages after some module updates (and use of $ drush updb and I'm not using "Comment notify" module. I even don't have the core "Comment" enabled. I cannot reproduce what triggers this.

Few examples:

Notice: Undefined index: revision in entity_extract_ids() (line 7376 of /var/www/html/includes/common.inc).
Notice: Undefined index: bundle in entity_extract_ids() (line 7379 of /var/www/html/includes/common.inc).

...and other that seems related
Notice: Undefined index: load hook in EntityAPIControllerExportable->attachLoad() (line 654 of /var/www/html/sites/all/modules/entity/includes/entity.controller.inc).
Notice: Undefined index: bundles in field_info_bundles() (line 576 of /var/www/html/modules/field/field.info.inc).
Warning: Invalid argument supplied for foreach() in _field_info_collate_fields() (line 215 of /var/www/html/modules/field/field.info.inc).

@claudiu.cristea, that seems pretty unrelated. Please create a new issue. It's probably related to some module on your site that uses tokens so please head in that direction.

StatusFileSize
new4.28 KB

This bug prevents the approval of comments if users will be notified about it. My findings validate what greggles and Dave Reid have found. The stub comment is missing a node type, which causes token generate to fail. On my site, this was a fatal error that raises the site's maintenance page.

I know that the patch Dave Reid posted in #8 doesn't have a consensus behind it, however it does fix immediate problem, but it has some errors that prevent it from working. hook_comment_load should not take a reference, and $record->nofity is a typo.

StatusFileSize
new5.26 KB

That patch was even more broke than I thought. This patch keeps the "comment notify" feature of this module from breaking. :-)

I'm increasingly OK with this general idea.

In comment_notify_comment_load why use a db_select and not use a simple (aka fast) db_query?

I'm not sure about this structure:

<?php
+  foreach ($records as $cid => $record) {
+   
$comments[$cid]->notify = $record->notify;
+   
$comments[$cid]->notify_hash = $record->notify_hash;
+   
$comments[$cid]->notified = $record->notified;
+   
$comments[$cid]->cmail = $record->cmail;
+   
$comments[$cid]->uinit = $record->uinit;
+   
$comments[$cid]->umail = $record->umail;
+  }
?>

We should probably namespace it a bit mroe:

<?php
+  foreach ($records as $cid => $record) {
+   
$comments[$cid]->comment_notify['notify'] = $record->notify;
+   
$comments[$cid]->comment_notify['notify_hash'] = $record->notify_hash;
+   
$comments[$cid]->comment_notify['notified'] = $record->notified;
+   
$comments[$cid]->comment_notify['cmail'] = $record->cmail;
+   
$comments[$cid]->comment_notify['uinit'] = $record->uinit;
+   
$comments[$cid]->comment_notify['umail'] = $record->umail;
+  }
?>

If we need data from the user table we should be using user_load() and not joining.

after upgrading 7.7 ->7.8
Impossible to add comment if exist another user comment. If comments of same user - no problem.

EntityMalformedException: Missing bundle property on entity of type comment. в функции entity_extract_ids() (7389 /includes/common.inc).

Comment form fields: Dropdown List(text), File (Module Media)

Same problem as dusov. I hope this will be fixed soon.

Same problem.

Subscribe

subscribe

upgraded to 7.8 a site i am building but have not released into the wild

i was referred here from this issue https://drupal.org/node/1273256

my error EntityMalformedException: Missing bundle property on entity of type comment. in entity_extract_ids() (line 7389 of...
when trying to view or add a forum topic or reply

i was able to make the message stop or come back by either disabling or enabling Comment subjects 7.x-2.x-dev

@joelko, @dusov, @grendzy, @rthuey, can you confirm the code from #14 works for you?

I do not know how to run the patch.

I tried the patch in #14 - it resolves the fatal PHP error, but comment_notify is now sending two copies of every notification.

Joelko - instructions can be found on http://drupal.org/patch/apply.

I've filled an issue to Comment subjects module with a patch which address an issue that return the same error described here: http://drupal.org/node/1276296

The tricks in that case was that when a new comment entity was needed the structure was missing the attribute 'node_type', entity which token module was passing to entity_extract_ids($entity_type, $entity) through its field_tokens(...) implementation.

I got a bug repport on release day of a new site today. Got the same error message on replies to comments. It worked fine when a new comment was posted but when it was in reply to another comment a error message was displayed and the reply wasn't saved.

Patch in #14 now makes it possible to send replies, seems to have saved my day!

Status:Needs work» Fixed

Actually I think my namespacing concern is not a good thing to fix now as it breaks other code.

Changing the query as I mentioned would make it faster but also uglier since $query->condition('c.cid', array_keys($comments)); is just so easy.

Now committed - http://drupalcode.org/project/comment_notify.git/commit/7c5a17a

Thanks, Dave Reid, bangpound.

@Dave Reid: I think the user_load point you make should be addressed in its own issue. I'm not sure I understand it enough to argue it yet.

Status:Fixed» Closed (fixed)

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

Title:Remove some internal helper functions, add data to comment_load, fully load comments before alertingMissing bundle property on entity of type comment

I have a backtrace if this helps. I am using comment notify, views, media, calendar, and signup. I can verify that this is for nodes where anyone commenting other than the original commenter will get the error. I'm not sure if this is in comment notify or tokens or somewhere else, but here goes (sorry, but the code tags don't work for format the code below):

[2] => Array
(
[function] => _drupal_exception_handler
[args] => Array
(
[0] => EntityMalformedException Object
(
[message:protected] => Missing bundle property on entity of type comment.
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => C:\wamp\www\drupal2\includes\common.inc
[line:protected] => 7405
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => C:\wamp\www\drupal2\sites\all\modules\token\token.tokens.inc
[line] => 1347
[function] => entity_extract_ids
[args] => Array
(
[0] => comment
[1] => stdClass Object
(
[cid] => 5
[nid] => 100
[uid] => 1
[name] => admin
[thread] => 01/
[notify] => 1
[notify_hash] => xDuM_G96sZqY5oC8IlyogA0BmYcbJU8
[cmail] =>
[uinit] => you@yourdomain.com
[umail] => admin@mysite.org
)

)

)

[1] => Array
(
[function] => field_tokens
[args] => Array
(
[0] => entity
[1] => Array
(
[author] => [comment-subscribed:author]
[unsubscribe-url] => [comment-subscribed:unsubscribe-url]
)

[2] => Array
(
[entity_type] => comment
[entity] => stdClass Object
(
[cid] => 5
[nid] => 100
[uid] => 1
[name] => admin
[thread] => 01/
[notify] => 1
[notify_hash] => xDuM_G6se_ImY5oC8ogA0B4OmYcbJU8
[cmail] =>
[uinit] => you@yourdomain.com
[umail] => admin@mydomain.org
)

[token_type] => comment
)

[3] => Array
(
[sanitize] =>
)

)

)

[2] => Array
(
[file] => C:\wamp\www\drupal2\includes\module.inc
[line] => 818
[function] => call_user_func_array
[args] => Array
(
[0] => field_tokens
[1] => Array
(
[1] => entity
[2] => Array
(
[author] => [comment-subscribed:author]
[unsubscribe-url] => [comment-subscribed:unsubscribe-url]
)

[3] => Array
(
[entity_type] => comment
[entity] => stdClass Object
(
[cid] => 5
[nid] => 100
[uid] => 1
[name] => admin
[thread] => 01/
[notify] => 1
[notify_hash] => xDuM_G96se_kGZqY5oC8IlyogA04nmYcbJU8
[cmail] =>
[uinit] => you@yourdomain.com
[umail] => admin@mydomain.org
)

[token_type] => comment
)

[4] => Array
(
[sanitize] =>
)

)

)

)

[3] => Array
(
[file] => C:\wamp\www\drupal2\includes\token.inc
[line] => 173
[function] => module_invoke_all
[args] => Array
(
[0] => tokens
[1] => entity
[2] => Array
(
[author] => [comment-subscribed:author]
[unsubscribe-url] => [comment-subscribed:unsubscribe-url]
)

[3] => Array
(
[entity_type] => comment
[entity] => stdClass Object
(
[cid] => 5
[nid] => 100
[uid] => 1
[name] => admin
[thread] => 01/
[notify] => 1
[notify_hash] => xDuM96se_ImkGZqY5oC8IlyB4O4nmYcbJU8
[cmail] =>
[uinit] => you@yourdomain.com
[umail] => admin@mydoman.org
)

[token_type] => comment
)

[4] => Array
(
[sanitize] =>
)

)

)

[4] => Array
(
[file] => C:\wamp\www\drupal2\sites\all\modules\token\token.tokens.inc
[line] => 747
[function] => token_generate
[args] => Array
(
[0] => entity
[1] => Array
(
[author] => [comment-subscribed:author]
[unsubscribe-url] => [comment-subscribed:unsubscribe-url]
)

[2] => Array
(
[entity_type] => comment
[entity] => stdClass Object
(
[cid] => 5
[nid] => 100
[uid] => 1
[name] => admin
[thread] => 01/
[notify] => 1
[notify_hash] => xDuM_96se_ImkGZqY5oC8IlyogA4nmYcbJU8
[cmail] =>
[uinit] => you@yourdomain.com
[umail] => admin@mckenziehoa.org
)

[token_type] => comment
)

[3] => Array
(
[sanitize] =>
)

)

)

Title:Missing bundle property on entity of type commentRemove some internal helper functions, add data to comment_load, fully load comments before alerting

@flightrisk please post a new issue.