Fix: (file = boost.module)

  // Get all args
  $args = arg($path);
  // Prevent array warnings
  $args[0] = empty($args[0]) ? '' : $args[0];
  $args[1] = empty($args[1]) ? '' : $args[1];
  $args[2] = empty($args[2]) ? '' : $args[2];
  $router_item['args'] = $args;

  // Get extra arguments
  $menu_args = arg(NULL, $router_item['path']);
  $diff = array();
  foreach ($args as $key => $value) {
+    if (!empty($menu_args[$key])) {
      if (!empty($value) && $value !== $menu_args[$key] && $menu_args[$key] !== '%') {
        $diff[] = $value;
      }
+    }
  }
  if (!empty($diff)) {
    $router_item['extra_arguments'] = implode('/', $diff);
  }
  else {
    $router_item['extra_arguments'] = '';
  }
CommentFileSizeAuthor
#3 boost-6.x-e_notice.patch478 bytesAlexisWilke

Comments

AlexisWilke’s picture

Status: Active » Needs review

Hi guys,

I notice this one too. The reason for the error is that the previous 3 statements using empty().

  $args[0] = empty($args[0]) ? '' : $args[0];
  $args[1] = empty($args[1]) ? '' : $args[1];
  $args[2] = empty($args[2]) ? '' : $args[2];

If you do that with the $args array, then so should you with the $menu_args array. Or as offered by Peter, use one extra isset() or !empty() test in the loop:

  if (!empty($value) && !empty($menu_args[$key]) && $value !== $menu_args[$key] && $menu_args[$key] !== '%')

Since you use empty() everywhere else, I guess this would be the fix.

Thank you.
Alexis

asb’s picture

Notice: Undefined offset: 3 in _boost_get_menu_router() (line 5206 of /var/www/drupal/sites/all/modules/boost/boost.module).

Patch, please?

AlexisWilke’s picture

Assigned: Unassigned » AlexisWilke
StatusFileSize
new478 bytes

I don't understand why anyone would need a patch to change one small entry when it's already shown in an issue.

bgm’s picture

Status: Needs review » Fixed

Committed to 6.x-1.x. Thanks for the fix.

asb’s picture

@Alexis: Because proper patches tend to increase the probability to get committed. This one took almost half a year, even with a patch, and I have a large number of fixes without patches in my watchlist that are not being committed for years.

So thank you very much for taking the time to analyze this issue and roll a patch!

Automatically closed -- issue fixed for 2 weeks with no activity.