Hello,

I found an annoying PHP notice from the entity field content type when no context is found. The code performs a watchdog using as variables the subtype, the content type's configuration array, and the context provided as follows:

/**
 * Returns the administrative title for a type.
 */
function ctools_entity_field_content_type_admin_title($subtype, $conf, $context) {
  list($bundle, $field_name) = explode(':', $subtype);
  ctools_include('fields');
  if (is_object($context) && isset($context->identifier)) {
    $identifier = $context->identifier;
  }
  else {
    $type = 'ctools_entity_field_content_type_admin_title';
    $message = t('Context is missing for field: @name', array('@name' => $subtype));
    $variables = array($subtype, $conf, $context);
    watchdog($type, $message, $variables, $severity = WATCHDOG_NOTICE);
    $identifier = t('Unknown');
  }

  return t('"@s" @field', array('@s' => $identifier, '@field' => ctools_field_label($field_name)));
}

The problem is watchdog will try and use this variables array as e replacement map, which will contain in index 1 the configuration array, causing a Array to string conversion notice.

I'm pretty sure we shouldn't be giving this configuration array to the watchdog function.

CommentFileSizeAuthor
#2 ctools-2671150-1.patch739 byteslucas.constantino
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lucas.constantino created an issue. See original summary.

lucas.constantino’s picture

FileSize
739 bytes

And here goes a simple patch suggestion. I guess this has to be thoroughly tested before aproval.

SocialNicheGuru’s picture

Status: Active » Needs review
SocialNicheGuru’s picture

Status: Needs review » Needs work

This section has been rewritten in ctools 7.x.1.10 so no longer applies.
But it does apply to versions before.