Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.674 diff -u -p -r1.674 common.inc --- includes/common.inc 13 Jul 2007 20:07:14 -0000 1.674 +++ includes/common.inc 15 Jul 2007 18:07:06 -0000 @@ -340,8 +340,13 @@ function drupal_not_found() { $path = drupal_get_normal_path(variable_get('site_404', '')); if ($path && $path != $_GET['q']) { + menu_set_active_item($path); $return = menu_execute_active_handler($path); } + else { + // Clear out the invalid path. + menu_set_active_item(''); + } if (empty($return)) { drupal_set_title(t('Page not found')); @@ -365,8 +370,13 @@ function drupal_access_denied() { $path = drupal_get_normal_path(variable_get('site_403', '')); if ($path && $path != $_GET['q']) { + menu_set_active_item($path); $return = menu_execute_active_handler($path); } + else { + // Clear out the invalid path. + menu_set_active_item(''); + } if (empty($return)) { drupal_set_title(t('Access denied')); Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.186 diff -u -p -r1.186 menu.inc --- includes/menu.inc 9 Jul 2007 18:08:15 -0000 1.186 +++ includes/menu.inc 15 Jul 2007 18:07:07 -0000 @@ -1155,7 +1155,11 @@ function menu_get_active_menu_name() { return menu_set_active_menu_name(); } -function menu_set_active_item() { +/** + * Set the active path. + */ +function menu_set_active_item($path) { + $_GET['q'] = $path; } /**