Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | ctools-2671150-1.patch | 739 bytes | lucas.constantino |
Comments
Comment #2
lucas.constantino CreditAttribution: lucas.constantino at Taller commentedAnd here goes a simple patch suggestion. I guess this has to be thoroughly tested before aproval.
Comment #3
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #4
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedThis section has been rewritten in ctools 7.x.1.10 so no longer applies.
But it does apply to versions before.