There's a fatal error when deleting a term. I was cleaning up my free-tagging vocabulary, removing any terms with no corresponding nodes.

Fatal error: Unsupported operand types in /sites/all/modules/xmlsitemap/xmlsitemap_taxonomy/xmlsitemap_taxonomy.module on line 180

I don't have any other taxonomy related modules, as far as I know.

Comments

andrewmacpherson’s picture

Priority: Normal » Critical

Marking as critical since it's a fatal error.

The (obvious) work around is to temporarily disable the XML sitemap taxonomy module, delete some terms, and re-enable the module.

Dave Reid’s picture

Assigned: Unassigned » Dave Reid

I'm on it.

Dave Reid’s picture

Thanks for the report. This internal taxonomy.module form workflow is just horrible, but I think I've got it fixed in CVS now. I tested deleting a term and it worked. Hopefully taxonomy.module can or is already fixed up in Drupal 7.

andrewmacpherson’s picture

Form API isn't my strong point, but will it be okay to change line 180 from:

$form['submit'] += array('#weight' => 50);

to:
$form['submit']['#weight'] = 50;

Tested and seems to work. Will roll patch soon. (There are some other instances of the += operator that probably want looking at, too.)

Dave Reid’s picture

Status: Active » Fixed

The change in #4 wouldn't be enough, because you'd see that the XML sitemap fieldset would be added to the delete confirm form, which doesn't make sense. This is fixed in CVS now.

andrewmacpherson’s picture

Thanks! Looks like we're both scratching this one at the same time.

EvanDonovan’s picture

Ok. I can report that the CVS fix works. Here's what it is, for anyone who wants to fix this error, without pulling down an entirely new version of the module:

function xmlsitemap_taxonomy_form_taxonomy_form_term_alter(&$form, $form_state) {
/* Because the same form is used for deletion in confirm_form, we must check
    if the normal editing form elements are present. Hopefully this is fixed in Drupal 7. */
 if (isset($form['identification'])) {
  if ($form['#term']['tid']) {
    $term = xmlsitemap_taxonomy_taxonomy_term_load($form['#term']['tid']);
  }
  else {
    $term = (object) $form['#term'];
  }
  $term->vid = $form['vid']['#value'];
  $link = xmlsitemap_taxonomy_create_link($term);

  // Add the link options.
  module_load_include('inc', 'xmlsitemap', 'xmlsitemap.admin');
  xmlsitemap_add_form_link_options($form, $link);

  $form['xmlsitemap']['#access'] |= user_access('administer taxonomy');
  if (user_access('administer taxonomy')) {
    $form['xmlsitemap']['priority']['#description'] .= ' ' . t('The default priority for this vocabulary can be changed here.', array('@link-type' => url('admin/content/taxonomy/edit/vocabulary/' . $term->vid, array('query' => drupal_get_destination()))));
  }

  // The submit and delete buttons need to be weighted down.
  $form['submit'] += array('#weight' => 50);
  if (isset($form['delete'])) {
    $form['delete'] += array('#weight' => 51);
  }
 }
}

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.