During creation of new node, the first call at hook_nodeapi($op = presave) the $node->nid, $node->vid are empty and node_tools try to do defined some node revision property.
<?php
switch ($op) {
case 'presave':
case 'load': // get here immediately after the node is fetched from db
if (!isset($node->current_revision_id)) {
$node->current_revision_id = node_tools_get_current_node_revision_id($node->nid);
$node->is_current = node_tools_revision_is_current($node);
$node->num_revisions = node_tools_get_number_of_revisions($node->nid);
}
?>
I think that is useless and mode add warnings in my simpletest :)
I propose this patch
<?php
switch ($op) {
case 'presave':
case 'load': // get here immediately after the node is fetched from db
if (!isset($node->current_revision_id) && isset($node->nid)) {
$node->current_revision_id = node_tools_get_current_node_revision_id($node->nid);
$node->is_current = node_tools_revision_is_current($node);
$node->num_revisions = node_tools_get_number_of_revisions($node->nid);
}
?>
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | node_tools-undefined_property_stdClass::-1710544-1.patch | 737 bytes | underq |
Comments
Comment #1
underq commentedThis patch is for HEAD of branch 6.x-3.x
Comment #2
rdeboerThanks! Applied and checked in. Sorry for the delay. Better late than never!
Comment #3
underq commentedYes thanks ;)