When visiting a publishcontent path for a non-existing node, the following message appears:
Notice: Trying to get property of non-object in publishcontent_tab_load() (line 70 of ../sites/all/modules/contrib/publishcontent/publishcontent.module).
Usually one will not visit these pages anyway, but it still there should be a robust behavior in case someone does.
I personally had this happen with devel "show redirection page", After deleting a node. But one can artificially reproduce this by visiting an url like 'node/123/publish/xyz', for a node id that does not exist.
Code now:
function publishcontent_tab_load($nid) {
if (is_numeric($nid)) {
$node = node_load($nid);
if (variable_get('publishcontent_' . $node->type, FALSE)) {
return $node;
}
}
return FALSE;
}
should be replaced with:
function publishcontent_tab_load($nid) {
if ($node = node_load($nid)) {
if (variable_get('publishcontent_' . $node->type, FALSE)) {
return $node;
}
}
return FALSE;
}
I think the is_numeric() is not really necessary. Core's node_load() is already used as a wildcard loader, so it should be safe enough.
No patch, because I'm lazy.
Comments
Comment #2
astonvictor commentedD7 reached its EOL back in January 2025, and there is no active release for D7 for this module anymore.
Development or support is not planned for D7. All D7-related issues are marked as outdated in a bunch.