If the plugin definition for an export UI plugin is broken, then the output still renders but doesn't work properly.

This is because ctools_export_ui_switcher_page() doesn't check that it managed to load a plugin before trying to get the handler class for it. ctools_export_ui_get_handler(NULL) returns a ctools_export_ui object with some default properties populated, which then attempts some output, which obviously doesn't work at all.

This code demonstrates the problem:

  ctools_include('export-ui');

  $plugin = ctools_get_export_ui('bananas');
  // Correctly gets NULL:
  var_dump($plugin);
  
  $handler = ctools_export_ui_get_handler($plugin);
  // Gets a broken handler, which will attempt to display.
  var_dump($handler);

Patch coming.

Comments

joachim’s picture

Status: Active » Needs review
StatusFileSize
new1.1 KB
chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 9 July 2015 patch to export-ui.inc does not apply to the latest ctools 7.x-1.x-dev and if still applicable needs to be re-rolled.

Checking patch includes/export-ui.inc...
error: while searching for:

  // Load the $plugin information
  $plugin = ctools_get_export_ui($plugin_name);
  $handler = ctools_export_ui_get_handler($plugin);

  if ($handler) {
    $method = $op . '_page';
    if (method_exists($handler, $method)) {
      // replace the first two arguments:
      $args[0] = $js;
      $args[1] = $_POST;
      return call_user_func_array(array($handler, $method), $args);
    }
  }
  else {
    return t('Configuration error. No handler found.');
  }
}

error: patch failed: includes/export-ui.inc:458
error: includes/export-ui.inc: patch does not apply
shubham.prakash’s picture

Status: Needs work » Needs review
StatusFileSize
new1.1 KB

Rerolled #1

joelpittet’s picture

Status: Needs review » Fixed
Issue tags: -Needs reroll

Thanks @joachim et al, I've tweaked the patch to shortcut earlier but the committed code does the same thing as the original patch.

  • joelpittet committed 17b892b on 7.x-1.x authored by joachim
    Issue #2530286 by joachim, shubham.prakash, Chris Matthews:...

Status: Fixed » Closed (fixed)

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