node_service_save watchdog entry assumes it updated an existing node
| Project: | Services |
| Version: | 6.x-0.14 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | snelson |
| Status: | duplicate |
Jump to:
if you use node.save to create a new node, the node_service_save function still sorta assumes you updated an existing one, as it only does $node = node_load(...) inside the if ($edit['nid']) { ... } clause
so when there is no nid passed (when creating a brand new node) it tries to enter this watchdog entry:
<?php
watchdog('content', '@type: updated %title.',
array('@type' => t($node->type), '%title' => $node->title),
WATCHDOG_NOTICE, l(t('view'), 'node/'. $node->nid));
?>leading to a watchdog entry that looks like " : updated " linking to "node/" and causing loads of errors like
preg_match() expects parameter 2 to be string, array given in C:\xampp\htdocs\wielphase2\includes\bootstrap.inc op regel 761.when watching the watchdog page, untill they eventually bump off the messages causing the error
as a temporary fix for myself, I added
<?php
$node = node_load($nid);
?>right under
<?php
// Fetch $nid out of $form_state
$nid = $form_state['nid'];
?>this keeps the errors from showing up on the watchdog page, but it leads to silly log entries like
page: updated someTitle
page: created someTitle
when there never was an update, only a create
I'll try to make a proper patch for this later tonight after I get home, so I can grab a latest CVS and migrate the watchdog call to inside the if ($edit['nid']) {...} clause or maybe even remove it entirely, not sure if the drupal_execute doesn't already add a watchdog entry

#1
The watchdog call in node.save has been removed in Services dev, it was redundant as saving the node with drupal_execute logs the save to watchdog.
#2
issue persists in 0.14 but I can see it's removed in -dev
can we get an 0.15 so this thing doesn't bug me about it being a dev? :P