Commit 70c097f2 authored by Dries's avatar Dries

- Modified patch #43082 by chx: return a 404 when a callback function does not exist.

parent c297f2e0
...@@ -337,10 +337,15 @@ function menu_execute_active_handler() { ...@@ -337,10 +337,15 @@ function menu_execute_active_handler() {
while ($path && !isset($menu['callbacks'][$path])) { while ($path && !isset($menu['callbacks'][$path])) {
$path = substr($path, 0, strrpos($path, '/')); $path = substr($path, 0, strrpos($path, '/'));
} }
if (!isset($menu['callbacks'][$path])) { if (!isset($menu['callbacks'][$path])) {
return MENU_NOT_FOUND; return MENU_NOT_FOUND;
} }
if (!function_exists($menu['callbacks'][$path]['callback'])) {
return MENU_NOT_FOUND;
}
if (!_menu_item_is_accessible(menu_get_active_item())) { if (!_menu_item_is_accessible(menu_get_active_item())) {
return MENU_ACCESS_DENIED; return MENU_ACCESS_DENIED;
} }
...@@ -352,7 +357,7 @@ function menu_execute_active_handler() { ...@@ -352,7 +357,7 @@ function menu_execute_active_handler() {
$arguments = array_merge($arguments, explode('/', $arg)); $arguments = array_merge($arguments, explode('/', $arg));
} }
return function_exists($menu['callbacks'][$path]['callback']) ? call_user_func_array($menu['callbacks'][$path]['callback'], $arguments) : ''; return call_user_func_array($menu['callbacks'][$path]['callback'], $arguments);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment