Closed (won't fix)
Project:
Migrate
Version:
7.x-2.x-dev
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Reporter:
Created:
19 May 2012 at 17:19 UTC
Updated:
29 Jul 2012 at 21:10 UTC
When saving forum module entries getting a messages
Undefined property: stdClass::$nid File /var/www/modules/forum/forum.module, line 332(file: /var/www/modules/forum/forum.module, line 332)
This caused by this part in forum module:
if (!empty($node->taxonomy_forums[$langcode])) {
$node->forum_tid = $node->taxonomy_forums[$langcode][0]['tid'];
$old_tid = db_query_range("SELECT f.tid FROM {forum} f INNER JOIN {node} n ON f.vid = n.vid WHERE n.nid = :nid ORDER BY f.vid DESC", 0, 1, array(':nid' => $node->nid))->fetchField();
if ($old_tid && isset($node->forum_tid) && ($node->forum_tid != $old_tid) && !empty($node->shadow)) {
// A shadow copy needs to be created. Retain new term and add old term.
$node->taxonomy_forums[$langcode][] = array('tid' => $old_tid);
}
}
to avoid this we just need have nid property defined. Thi will not cause problems with core, sinse drupal_write_record() verifies NULL properties for fields, which have 'not null' flag.
| Comment | File | Size | Author |
|---|---|---|---|
| notice-when-saving-forum-entry.patch | 475 bytes | gumanist |
Comments
Comment #1
mikeryanI've reported this as a core bug: #1592962: (tests followup) Notice generated when programmatically creating a forum node.
I'm a little wary of such a global response to such a narrow bug - depending on how other code (hooks, migration plugins, ...) checks the presence of $node->nid (empty/isset/is_null) this may have unwanted effects elsewhere.
Comment #2
mikeryanIt's not worth hacking Migrate to fix a cosmetic core bug...