Project:XML sitemap
Version:6.x-2.x-dev
Component:xmlsitemap_taxonomy.module
Category:bug report
Priority:critical
Assigned:Dave Reid
Status:closed (fixed)

Issue Summary

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

#1

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.

#2

Assigned to:Anonymous» Dave Reid

I'm on it.

#3

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.

#4

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.)

#5

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.

#6

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

#7

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:

<?php
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 <a href="@link-type">here</a>.', 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);
  }
}
}
?>

#8

Status:fixed» closed (fixed)

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