You do this:
$item = module_invoke_all('taxonomy_menu_'. $op, $item);
which leads those errors:
# warning: Illegal offset type in isset or empty in /var/www/ademe-usine/drupal-dr/www/modules/taxonomy/taxonomy.module on line 1011.
# warning: Illegal offset type in /var/www/ademe-usine/drupal-dr/www/modules/taxonomy/taxonomy.module on line 1012.
# warning: Illegal offset type in /var/www/ademe-usine/drupal-dr/www/modules/taxonomy/taxonomy.module on line 1015.
# warning: Illegal offset type in isset or empty in /var/www/ademe-usine/drupal-dr/www/includes/common.inc on line 902.
# warning: Illegal offset type in isset or empty in /var/www/ademe-usine/drupal-dr/www/modules/locale/locale.module on line 362.
# warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /var/www/ademe-usine/drupal-dr/www/includes/database.mysql.inc on line 321.
and this is because of the array_merge behavior in:
function module_invoke_all() {
$args = func_get_args();
$hook = $args[0];
unset($args[0]);
$return = array();
foreach (module_implements($hook) as $module) {
$function = $module .'_'. $hook;
$result = call_user_func_array($function, $args);
if (isset($result) && is_array($result)) {
$return = array_merge_recursive($return, $result);
}
else if (isset($result)) {
$return[] = $result;
}
}
return $return;
}
which, technically, gives us as return when two modules implement the hook:
Array
(
[tid] => Array
(
[0] => 20
[1] => 20
)
[name] => Array
(
[0] => Actualité
[1] => Actualité
)
[description] => Array
(
[0] =>
[1] =>
)
[weight] => Array
(
[0] => 0
[1] => 0
)
[vid] => Array
(
[0] => 6
[1] => 6
)
[ptid] => Array
(
[0] => 0
[1] => 0
)
[menu_name] => Array
(
[0] => menu-main-menu
[1] => menu-main-menu
)
)
So, there is two choices, either change the hook signature with a & to force ref, but no return (first patch attached) or use drupal_alter() (second patch attach), choose your weapon, but fix this.
PS: the first one is better is does not changes the functions names.
| Comment | File | Size | Author |
|---|---|---|---|
| taxonomy_menu.module-alter.patch | 1.58 KB | pounard | |
| taxonomy_menu.module-ref.patch | 1.56 KB | pounard |
Comments
Comment #1
pounardAnd ho, I think the first one won't work because of module_invoke_all() function which seems to loose the reference.
Comment #2
indytechcook commentedHello pounard, thanks for the patches but you must be looking at older code.
This line of code does hasn't existed in taxonomy menu since May 19th 2009 :)
Issue: #446714: Taxonomy Menu API hooks
Commit: http://drupal.org/cvs?commit=213836
Cheers
Comment #3
pounardI just download the 2.3 version, bug is still in it.
I did not see the resolved bug because it's closed. It scares me because in -dev version I dont't see the features that allows item alteration, and I really need it.
Does this feature is going to stay in future versions?
Comment #4
pounardOh, found it. Thanks for replying, I close this bug.