Strict warning for undefined variable, and non-working $menu variable. Patch supplied
dman - July 20, 2009 - 14:45
| Project: | Local Menu |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | duplicate |
Jump to:
Description
It doesn't seem to have been hurting anything yet, but running with STRICT warnings on it threw a notice about the use of a useless variable $menu in line 99, menu.module.
This seems to show that the line was never working as intended
Here's a fix.
diff -u -p -r1.8 local_menu.module
--- local_menu.module 19 Mar 2008 15:25:18 -0000 1.8
+++ local_menu.module 20 Jul 2009 14:36:58 -0000
@@ -91,12 +91,13 @@ function local_menu_block($op = 'list',
// Set current path temporarily to the root of the possible local task we might be, so Drupal finds it's way
$q = $_GET['q'];
$_GET['q'] = $item['href'];
- $tree = menu_tree_page_data(menu_get_active_menu_name());
+ $menu_name = menu_get_active_menu_name();
+ $tree = menu_tree_page_data($menu_name);
$_GET['q'] = $q;
$depth = variable_get('local_menu_depth', LOCAL_MENU_UNLIMITED);
$start = variable_get('local_menu_start', 2);
- $title = db_result(db_query("SELECT title FROM {menu_custom} WHERE menu_name = '%s'", $menu));
+ $title = db_result(db_query("SELECT title FROM {menu_custom} WHERE menu_name = '%s'", $menu_name));
if ($start == LOCAL_MENU_TOP && $depth == LOCAL_MENU_UNLIMITED) {
$block['subject'] = check_plain($title);I also see that the file contains a bunch of tabs - can we clean that up? it looks like it may be a huge global patch, so I'll leave that to the maintainers.

#1
Fixed in CVS. Thanks!
#2
Duplicate of #316345: Undefined variable when using Drupal 6.x dev