Closed (fixed)
Project:
Devel
Version:
7.x-1.0-beta2
Component:
devel_generate
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jun 2010 at 19:07 UTC
Updated:
3 Dec 2011 at 20:47 UTC
I was testing a forum thing, so I set it up to generate a bunch of forum nodes, and got a whole bunch of this error, one for each node:
"Notice: Undefined property: stdClass::$nid in forum_node_presave() (line 345 of /var/www/drupal7/modules/forum/forum.module)."
The problem, basically, is that when you create a node via a form, and it makes it's way through node_save(), the $node->nid exists on the object, and is NULL. But when devel_generate_content_add_node calls node_save(), the $node->nid does not exist on the object.
Comments
Comment #1
moshe weitzman commentedcommitted the fix. thanks.
Comment #2
mgiffordAny idea when the next stable release will be out? I ran into this error too.
Comment #4
nicholasthompsonIt's also worth noting (if anyone stumbles on this in the future) that if you create a node using SimpleTest's
drupalCreateNodefunction, you need to pass a NULL nid item in the array... eg:If you don't then you run into the same issue described above.
The Forum module's test doesn't expose this as it posts to the "node/add/forum/1" page.
(sorry for dragging an old issue back up - but I found this through Google for a different problem caused by the same issue)
EDIT: Maybe there should be an
isset()test before that query?Comment #5
darksnowI should apologise for bringing this up again too, but I've run into it during a migration I'm working on.
In pre_save, there is no nid, so I'd second the motion for an isset() call.
This looks similar to an issue in profile http://drupal.org/node/777168