This stems from #564492: Plugin definition incompatibilities.

If I define the plugin in a .info file, the class file is loaded at the proper time, but a new bug pops up. This code:

  // If cached the .inc file may not have been loaded. require_once is quite safe
  // and fast so it's okay to keep calling it.
  if (isset($plugin['file'])) {
    require_once './' . $plugin['path'] . '/' . $plugin['file'];
  }

from ctools_plugin_get_class() tries to include $plugin['file'], which in this case is a .info file. This results in the contents of the info file being output to the browser.

The same code block exists in ctools_plugin_get_function().

This patch seems to fix the issue. It seems like I should be able to check to see if the ['info file'] flag is set on the plugin info, but I couldn't figure out how to get that.

Comments

merlinofchaos’s picture

Use ctools_plugin_get_info() to get the $info -- the arguments needed should be available from the $plugin data. That's much safer than checking for .info

zroger’s picture

StatusFileSize
new1.61 KB

new patch using ctools_plugin_get_info() and checking $info['info file'] rather than the strpos().

zroger’s picture

StatusFileSize
new1.62 KB

new patch using empty() to avoid notices.

merlinofchaos’s picture

Status: Needs review » Fixed

Committed!

Status: Fixed » Closed (fixed)

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