diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/graph.inc | 16 | ||||
-rw-r--r-- | includes/module.inc | 2 |
2 files changed, 11 insertions, 7 deletions
diff --git a/includes/graph.inc b/includes/graph.inc index 38b2abb1c..e9fffc587 100644 --- a/includes/graph.inc +++ b/includes/graph.inc @@ -121,19 +121,23 @@ function _drupal_depth_first_search(&$graph, &$state, $start, &$component = NULL unset($state['components'][$component]); $component = $new_component; } + // Only visit existing vertices. + if (isset($graph[$end])) { + // Visit the connected vertex. + _drupal_depth_first_search($graph, $state, $end, $component); - // Visit the connected vertex. - _drupal_depth_first_search($graph, $state, $end, $component); - - // All vertices reachable by $end are also reachable by $start. - $graph[$start]['paths'] += $graph[$end]['paths']; + // All vertices reachable by $end are also reachable by $start. + $graph[$start]['paths'] += $graph[$end]['paths']; + } } } // Now that any other subgraph has been explored, add $start to all reverse // paths. foreach ($graph[$start]['paths'] as $end => $v) { - $graph[$end]['reverse_paths'][$start] = TRUE; + if (isset($graph[$end])) { + $graph[$end]['reverse_paths'][$start] = TRUE; + } } // Record the order of the last visit. This is the reverse of the diff --git a/includes/module.inc b/includes/module.inc index 71db71f57..dbe51279b 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -170,7 +170,7 @@ function _module_build_dependencies($files) { } drupal_depth_first_search($graph, array_keys($roots)); foreach ($graph as $module => $data) { - $files[$module]->required_by= isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); + $files[$module]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); $files[$module]->requires = isset($data['paths']) ? $data['paths'] : array(); $files[$module]->sort = $data['weight']; } |