Firstofall let me thank you for your good an hard work in this module. It works great!
In some edge-cases I have a major problem causing Exceptions and breaking the site.
The reason and fix is quite simple:
Context:
Deleting nodes or updating deleted nodes.
Problem:
The following function does not check if the (loaded) node truely exists. If node_load returns FALSE (means: node no more existing), the function simply proceeds, which leads to an Exception in includes/common.inc: "Missing bundle property on entity of type node" (Line 7765).
function nodereference_count_update_count($nid) {
$node = node_load($nid);
field_attach_presave('node', $node);
field_attach_update('node', $node);
}
Solution: Simply check if the node exists:
function nodereference_count_update_count($nid) {
$node = node_load($nid);
if($node !== FALSE) {
field_attach_presave('node', $node);
field_attach_update('node', $node);
}
}
The solution was tested successfully and has no risk.
Comments
Comment #1
Anybody