Error:
warning: mysqli_real_escape_string() expects parameter 2 to be string, array given in Z:\home\landsvet\www\includes\database.mysqli.inc on line 323.
Website languages enabled: English, Russian (Russian is active by default)

It turned out that taxonomy_menu calls _taxonomy_menu_save() function on delete event, and $item['name'] = NULL in that case.

So this string gets all the translations for the current language
$link = array(
'link_title' => t($item['name']), // <-- here we get t(NULL); and we get array(2000) of strings instead of 1 string
and it causes the error.

As far as I understand there is no reason to call menu_link_save() on term deletion - we should call menu_link_delete() (I think)

So I've added

if (!isset($item['name'])) {
    menu_link_delete($item['mlid']);
    return TRUE;
  }

before line 448

$link = array(
    'link_title' => t($item['name']),

and it seems to work. At least the error is gone. Please check if this fix is a correct one.

Comments

indytechcook’s picture

menu_link_delete is already called

taxonomy_menu_taxonomy -> taxonomy_menu_handler(op == 'delete) -> taxonomy_menu_taxonomy_menu_delete (via invoke) -> menu_link_delete.

It calls menu_link_save more for delete a node rather then the term. They both call taxonomy_menu_handler(op == 'delete). In the case of the node, it deletes the menu item then recreates it.

For the term delete do the following:

in taxonomy_menu_handler change

return _taxonomy_menu_save($item);

TO

  if ($op != 'delete') {
    return _taxonomy_menu_save($item);
  }

But then when you delete a node the menu link is removed. It is necessary to update the menu item when it is deleted to keep the count correct. I'm looking for a good way to implement this.

indytechcook’s picture

Status: Needs work » Closed (duplicate)

This is a duplicate of #472004: Erros on term deletion which is being put into the next release.