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

Morbus Iff drupal-devel at drupal.org
Thu Mar 31 22:15:47 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:   Morbus Iff
 Status:       active

Well, I plan on redoing the delete code at some point, it is not in my
folksonomy patch.


Morbus Iff



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

March 26, 2005 - 08: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.


------------------------------------------------------------------------

March 26, 2005 - 08:43 : wiz

Attachment: http://drupal.org/files/issues/taxonomy-save.patch (471 bytes)

Oops, forgot the patch


------------------------------------------------------------------------

March 26, 2005 - 08:58 : Junyor

Don't forget to change the status to patch when you upload a patch. :)


------------------------------------------------------------------------

March 26, 2005 - 09:34 : wiz

All right, but moshe weitzman told me not to do this right away:
"please set issues to patch once they have been tested.
"
I assume that you have thoroughly tested the patch before changing
status ;)


------------------------------------------------------------------------

March 26, 2005 - 10:26 : Junyor

Fair enough.  But then you should ask for people to test it. ;)


------------------------------------------------------------------------

March 27, 2005 - 06:44 : moshe weitzman

A patch for this issue is welcome. I think though that this fix is part
of the upcoming folksonomy changes by Morbus ... the fix proposed here
might have problems if the user wants to remove all terms on an
existing node. not sure.
If you have authored and tested a patch yourself, it is OK to set to
patch status. I just object to people moving the testing burden to the
CVS reviewers.





More information about the drupal-devel mailing list