so here is the issue:
get a a vocabulary where terms can have only one parent
create a term with a non root parent
now go to edit this term and press save
on the submit the parent field will revert back to root (though this is not saved just shown)

the problem happens in taxonomy.admin.inc within taxonomy_form_term_submit():

  $current_parent_count = count($form_state['values']['parent']);
  $previous_parent_count = count($form['#term']['parent']);
  // Root doesn't count if it's the only parent.
  if ($current_parent_count == 1 && isset($form_state['values']['parent'][0])) {
    $current_parent_count = 0;
    $form_state['values']['parent'] = array();
  }

what does this do when $form_state['values']['parent'] equals to '3' ?
yes....
fortunately the term save happens before this so this aint saved. however can freak out ppl / tests who see this and on subsequent submit functions it could cause some interesting results as well.

Comments

nagba’s picture

Status: Active » Needs review
StatusFileSize
new1.13 KB

i didnt want to replicate all the is_array() checks that happens in taxonomy_term_save, so opinions are welcome.

montesq’s picture

Hi nagba,

I can't reproduce the issue on D7 HEAD.
Do you reproduce on your side? And if yes give the detailed steps to reproduce from scratch?
Thanks in advance.

nagba’s picture

i'll check again bit later.

mgifford’s picture

Assigned: nagba » Unassigned
Issue summary: View changes
Status: Needs review » Needs work

No longer applies.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.