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?
Comment | File | Size | Author |
---|---|---|---|
#14 | 1255250-comment-load-proper-13.patch | 5.26 KB | Anonymous (not verified) |
#13 | 1255250-comment-load-proper-12.patch | 4.28 KB | Anonymous (not verified) |
#8 | 1255250-comment-load-proper.patch | 4.28 KB | Dave Reid |
Comments
Comment #1
gregglesI don't see this error on a default installation. I wonder if it's actually related to token generation somehow.
Comment #2
gregglesbetter status.
Comment #3
aeroweb340 CreditAttribution: aeroweb340 commentedSame 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?
Comment #4
Dave ReidI 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.
Comment #5
clata CreditAttribution: clata commentedSame 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
Comment #6
gregglesI don't think that's the case. $comment comes from the various hook_comment_{blah} so those should really work with token.
Again, I'm not sure what you mean here. Maybe post a patch with at least theory of what you're talking about?
Comment #7
Dave ReidThe 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.Comment #8
Dave ReidPartial patch that at least shows where the problem is and how we start fixing it.
Comment #9
gregglesI'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.
Comment #10
dcmistry CreditAttribution: dcmistry commentedsubscribe
Comment #11
claudiu.cristeaI'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:
...and other that seems related
Comment #12
greggles@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.
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedThis 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.
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedThat patch was even more broke than I thought. This patch keeps the "comment notify" feature of this module from breaking. :-)
Comment #15
gregglesI'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:
We should probably namespace it a bit mroe:
Comment #16
Dave ReidIf we need data from the user table we should be using user_load() and not joining.
Comment #17
dusov CreditAttribution: dusov commentedafter 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)
Comment #18
Joenet-dupe CreditAttribution: Joenet-dupe commentedSame problem as dusov. I hope this will be fixed soon.
Comment #19
gagoo CreditAttribution: gagoo commentedSame problem.
Subscribe
Comment #20
grendzy CreditAttribution: grendzy commentedsubscribe
Comment #21
rthuey CreditAttribution: rthuey commentedupgraded 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
Comment #22
greggles@joelko, @dusov, @grendzy, @rthuey, can you confirm the code from #14 works for you?
Comment #23
Joenet-dupe CreditAttribution: Joenet-dupe commentedI do not know how to run the patch.
Comment #24
grendzy CreditAttribution: grendzy commentedI 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.
Comment #25
drikc CreditAttribution: drikc commentedI'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.
Comment #26
Vikom CreditAttribution: Vikom commentedI 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!
Comment #27
gregglesActually 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.
Comment #29
flightrisk CreditAttribution: flightrisk commentedI 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] =>
)
)
)
Comment #30
greggles@flightrisk please post a new issue.