[drupal-devel] [bug] possible bug in taxnomy_node_save

wiz drupal-devel at drupal.org
Sat Mar 26 13:43:45 UTC 2005


Issue status update for http://drupal.org/node/19494

 Project:      Drupal
 Version:      cvs
 Component:    taxonomy.module
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  wiz
 Updated by:   wiz
 Status:       active
 Attachment:   http://drupal.org/files/issues/taxonomy-save.patch (471 bytes)

Oops, forgot the patch


wiz



Previous comments:
------------------------------------------------------------------------

March 26, 2005 - 14:42 : wiz

Hi,
taxnomy_nodeapi calls taxonomy_node_save on insert and update.  This
function, in turn, saves the taxonomy of the node. Unfortunately it
first deletes all terms for the current node, and then inserts them
again /if they have been loaded before/. taxonomy_nodeapi doesn't
respond to 'load'. Therefore, unless you've done something like
$node->taxonomy = taxonomy_node_get_terms($node) the terms are lost.
See: http://drupaldocs.org/api/head/function/taxonomy_node_save
Solution: move the call to taxonomy_node_delete($nid) inside the if
(is_array($terms)). When the terms haven't been loaded they won't be
saved either.





More information about the drupal-devel mailing list