Closed (duplicate)
Project:
Drupal core
Version:
x.y.z
Component:
node system
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
18 Jan 2006 at 20:09 UTC
Updated:
18 Jan 2006 at 21:46 UTC
DRUPAL-4-7 branch.
This bug was introduced by Patch #33747 by Ber and Moshe: bugfix + code improvement: clean up some of the taxonomy loading code. (original issue).
As of that patch, a node object gets a taxonomy field when loading. Function taxonomy_form_alter thinks it should be in another format, though:
if (!isset($node->taxonomy)) {
if ($node->nid) {
$terms = taxonomy_node_get_terms($node->nid);
}
else {
$terms = array();
}
}
else {
$terms = $node->taxonomy;
}
// Some code omitted
$ntterms = isset($node->taxonomy) ? $terms : array_keys($terms);
In this case, array_key($terms) would be the way to get the right data. Perhaps we can simply always do that - but I am not sure why this test is here anyway. On the other hand, if we have a taxonomy node field, we should make sure it always has the same format, so that might be the right way to fix it anyway.
Thanks,
Frodo
Comments
Comment #1
Bèr Kessels commentedComment #2
killes@www.drop.org commentedI can confirm this bug exists.
Comment #3
riccardoR commentedI had the same problem, but it seems now fixed at a lower level (on theme_select) by this recently committed patch: drupal.org/node/45281
Anyway, before applying this patch, I had tried the same change that Frodo suggests and it worked:
I was not able to find any reason for $ntterms to be either an array of integer or an associative array, depending on
isset($node->taxonomy).Comment #4
Bèr Kessels commentedI cannot confirm this bug. pleasemake sure it is not a duplicate of http://drupal.org/node/45281
Comment #5
Bèr Kessels commentedhttp://drupal.org/node/45281