Recent updates breaks our sites with a fatal error. The ctools/includes/plugins.inc is trying to include a plugin file that got removed with the latest oembed update (file plugins/export_ui/oembed_preset.inc)

ctools 7.x-1.2
oembed 7.x-0.1.beta3

[Wed Sep 05 15:49:36 2012] [error] [client 152.23.170.31] PHP Fatal error: require_once(): Failed opening required '/Library/WebServer/Documents/drupal7/sites/all/modules/oembed/plugins/export_ui/oembed_preset.inc' (include_path='.:/php/includes:/usr/lib/php/Zend/library') in /Library/WebServer/Documents/drupal7/sites/all/modules/ctools/includes/plugins.inc on line 475

Files: 
CommentFileSizeAuthor
#3 plugin-load-use-include-1775612-3.patch603 bytesbartram
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]
#2 1775612-calling-missing-file-2.patch1.26 KBianthomas_uk
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

Comments

This should be fixed with a cache clear.

Status:Active» Needs review
StatusFileSize
new1.26 KB
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

A cache clear would fix this, but if you're getting a white screen of death then you may not be able to clear your cache, even using Drush.

If we throw an exception instead of letting PHP trigger a fatal error then this will be caught by the default exception handler and you'll be able to clear the cache with Drush. It also gives other modules the chance to handle this error themselves (e.g. hiding the block that the ctools plugin is used in, but showing the rest of the page).

I've attached an example patch of how this could work, as I didn't want to waste time on a complete patch if it would not be accepted. Worth noting is that this patch only catches one of at least two instances of require_once that we'd want to handle, and it uses PHP's generic Exception class rather than a more specific exception. I'd be happy to make these changes if such a patch would be accepted (any suggestions for what Exception should be thrown?).

Drupal 8 core plugins already throw exceptions, but the messages are being improved in https://drupal.org/node/1897762 and https://drupal.org/node/1846070

StatusFileSize
new603 bytes
PASSED: [[SimpleTest]]: [MySQL] 67 pass(es).
[ View ]

This issue also occurs for me when switching between branches on other modules, where one branch has defined a plugin, and the other branch is a few commits behind. When switch back to the old branch, I get the WSOD, and I am unable to clear my cache, even with Drush.
Is there a reason for using 'require_once' instead of 'include_once'? It's not the end of the world if the file doesn't exist, but 'require_once' acts like it is. The function name ('ctools_plugin_load_includes') suggests that the module should use 'include_once'.
Here's a patch. If the file goes missing, I can still clear my cache, and ignore any errors that show up.

I ran into this when moving module files around (from a subdirectory in "profiles" into sites/all/modules).

Truncating the cache table manually allowed me to clear the cache with drush:

drush sqlq 'truncate table cache'