Hi,

after clear cache the following error message appears:

Notice: Undefined index: export in ctools_export_crud_load() (line 75 of modules/ctools/includes/export.inc).

To avoid empty schema handling I've added an extra if to that line which fixed that bug:

function ctools_export_crud_load($table, $name) {
  $schema = ctools_export_get_schema($table);
  if(is_array($schema) && !empty($schema)){
    $export = $schema['export'];
  
    if (!empty($export['load callback']) && function_exists($export['load callback'])) {
      return $export['load callback']($name);
    }
    else {
      $result = ctools_export_load_object($table, 'names', array($name));
      if (isset($result[$name])) {
        return $result[$name];
      }
    }
  }
}

Comments

hass’s picture

hass’s picture

The source of this issue is a NULL value in $table. Therefore the condition is too late. Aside of this there are several functions that can also break the same way with NULL in $table.

swentel’s picture

Status: Active » Postponed (maintainer needs more info)

@frizi, can you try changing the code to this for a minute:

  $schema = ctools_export_get_schema($table);
  if (!isset($schema['export'])) {
    drupal_set_message(print_r(debug_backtrace(), true));
   // Or use devel.
   // ddebug_backtrace();
  }
  $export = $schema['export'];

That way we can try and identity throught this trace where the problem might be.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
BDaggerhart’s picture

I've been getting this notice recently as well, usually after clearing caches and/or running cron. I've read this thread and 3 others that have similar notices, and am not sure what to do about it. Any advice?

realityloop’s picture

Issue summary: View changes

@swentel

When trying to save a context:

Array ( [0] => Array ( [file] => /var/aegir/platforms/fv-7.39/profiles/family_violence/modules/contrib/ctools/plugins/export_ui/ctools_export_ui.class.php [line] => 47 [function] => ctools_export_crud_load [args] => Array ( [0] => [1] => layout-not_front ) ) [1] => Array ( [file] => /var/aegir/platforms/fv-7.39/profiles/family_violence/modules/contrib/ctools/ctools.module [line] => 873 [function] => load_item [class] => ctools_export_ui [object] => ctools_export_ui Object ( [plugin] => [name] => [options] => Array ( ) ) [type] => -> [args] => Array ( [0] => layout-not_front ) ) [2] => Array ( [function] => ctools_export_ui_load [args] => Array ( [0] => layout-not_front [1] => context ) ) [3] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/menu.inc [line] => 592 [function] => call_user_func_array [args] => Array ( [0] => ctools_export_ui_load [1] => Array ( [0] => layout-not_front [1] => context ) ) ) [4] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/menu.inc [line] => 763 [function] => _menu_load_objects [args] => Array ( [0] => Array ( [path] => admin/structure/context/list/%/edit [load_functions] => a:1:{i:4;a:1:{s:21:"ctools_export_ui_load";a:1:{i:0;s:7:"context";}}} [to_arg_functions] => [access_callback] => _tweaker_menu_access_callback [access_arguments] => a:5:{i:0;s:51:"admin/structure/context/list/%ctools_export_ui/edit";i:1;s:28:"ctools_export_ui_task_access";i:2;s:7:"context";i:3;s:4:"edit";i:4;i:4;} [page_callback] => ctools_export_ui_switcher_page [page_arguments] => a:3:{i:0;s:7:"context";i:1;s:4:"edit";i:2;i:4;} [delivery_callback] => [fit] => 61 [number_parts] => 6 [context] => 1 [tab_parent] => admin/structure/context/list/% [tab_root] => admin/structure/context/list/% [title] => Edit [title_callback] => t [title_arguments] => [theme_callback] => [theme_arguments] => a:0:{} [type] => 140 [description] => [position] => [weight] => -10 [include_file] => profiles/family_violence/modules/contrib/ctools/includes/export-ui.inc ) [1] => Array ( [0] => admin [1] => structure [2] => context [3] => list [4] => layout-not_front [5] => edit ) ) ) [5] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/menu.inc [line] => 474 [function] => _menu_translate [args] => Array ( [0] => Array ( [path] => admin/structure/context/list/%/edit [load_functions] => a:1:{i:4;a:1:{s:21:"ctools_export_ui_load";a:1:{i:0;s:7:"context";}}} [to_arg_functions] => [access_callback] => _tweaker_menu_access_callback [access_arguments] => a:5:{i:0;s:51:"admin/structure/context/list/%ctools_export_ui/edit";i:1;s:28:"ctools_export_ui_task_access";i:2;s:7:"context";i:3;s:4:"edit";i:4;i:4;} [page_callback] => ctools_export_ui_switcher_page [page_arguments] => a:3:{i:0;s:7:"context";i:1;s:4:"edit";i:2;i:4;} [delivery_callback] => [fit] => 61 [number_parts] => 6 [context] => 1 [tab_parent] => admin/structure/context/list/% [tab_root] => admin/structure/context/list/% [title] => Edit [title_callback] => t [title_arguments] => [theme_callback] => [theme_arguments] => a:0:{} [type] => 140 [description] => [position] => [weight] => -10 [include_file] => profiles/family_violence/modules/contrib/ctools/includes/export-ui.inc ) [1] => Array ( [0] => admin [1] => structure [2] => context [3] => list [4] => layout-not_front [5] => edit ) ) ) [6] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/menu.inc [line] => 1757 [function] => menu_get_item [args] => Array ( ) ) [7] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/menu.inc [line] => 1772 [function] => menu_get_custom_theme [args] => Array ( [0] => 1 ) ) [8] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/common.inc [line] => 5243 [function] => menu_set_custom_theme [args] => Array ( ) ) [9] => Array ( [file] => /var/aegir/platforms/fv-7.39/includes/bootstrap.inc [line] => 2262 [function] => _drupal_bootstrap_full [args] => Array ( ) ) [10] => Array ( [file] => /var/aegir/platforms/fv-7.39/index.php [line] => 20 [function] => drupal_bootstrap [args] => Array ( [0] => 7 ) ) )

Error messageNotice: Undefined index: export in ctools_export_crud_load() (line 80 of /var/aegir/platforms/fv-7.39/profiles/family_violence/modules/contrib/ctools/includes/export.inc).

The requested page "/admin/structure/context/list/layout-not_front/edit" could not be found.

projects[context][version] = 3.6
; Reduce markup - https://drupal.org/node/1540292#comment-5893692
projects[context][patch][] = https://drupal.org/files/0001-Issue-1540292-Only-add-context-ui-markup-if-user-has.patch
; Speed up Context UI - https://drupal.org/node/873936#comment-5624148
projects[context][patch][] = https://drupal.org/files/context_0001-Issue-873936-by-wojtha-Fabianx-Massively-increase-pe.patch

projects[ctools][version] = 1.9


projects[ds][version] = 2.11
; Allow relationship in View display plugin - http://drupal.org/node/1903880#comment-7007050
projects[ds][patch][] = http://drupal.org/files/display_relationship-1903880-1.patch
; Reusable block regions - https://drupal.org/comment/8421805#comment-8421805
projects[ds][patch][] = https://drupal.org/files/issues/reusable_region_blocks-2183217-1.patch
realityloop’s picture

Status: Closed (cannot reproduce) » Active
realityloop’s picture

Version: 7.x-1.0 » 7.x-1.9
Deciphered’s picture

So this is an issue I've seen in multiple modules that use CTools plugins. I'm not sure if I've ever reported it in CTools itself, rather I've dealt with it in various different modules on behalf of the developers.

The issue is related to the way CTools loads plugins with require_once, as if for some reason in that same runtime if that plugin is required, then some cache is cleared, and then something else is requiring that plugin definition things go bad, because the second request for that plugin definition doesn't work due to the file already being included/required.

The solution I recommend to modules having this issue is to declare their plugin definition with the partially unknown plugin definition hook: MODULE_NAME_PLUGIN_NAME_ctools_PLUGIN_TYPE().

Ideally this issue should probably be dealt with at the source, but I suspect that will be a massive job.

I will try to take some time to create some a proper reproducible set of steps to show this issue, as this is a very difficult issue to actually witness and debug.

Deciphered’s picture

Two issues I've previously dealt, both with some details related to this issue:

#2386819: Encrypt/Decrypt and cache clear issue with CTools plugin system
#2513714: CTools plugin issue

dasj19’s picture

I am experiencing the same issue.. any fix for this?

dasj19’s picture

Version: 7.x-1.9 » 7.x-1.x-dev