[development] Strange behavior with the menu API

Jacob Singh jacob at civicactions.com
Fri Jan 25 08:49:53 UTC 2008

Hi folks,

I was messing with the menu API while writing an update routine and
stumbled across this:

$item = menu_get_item(null,'mypath');
$item['path'] = 'mynewpath';
$ret = menu_save_item($item);
$ret == SAVED_NEW

I dug into the code and found out that menu_save_item requires the mid,
and menu_get_item doesn't return it, although it is totally available...
This seems like a major API usability bug, but I imagine there is some
reason for it being this way.

I guess in 6 this is moot because the whole structure is different in
this regard, but is there something I'm missing here?  Is this something
worth patching (adding the mid to the returned value of menu_get_item()
) in 5?

All the best,

More information about the development mailing list