Hi! I've found a small bug on the metatag_ui module: metatag_ui_config_overview() calls check_plain() and in one case the argument is an array instead of a string.
More precisely:
foreach ($config->config as $metatag => $value) {
$summary[] = array(
check_plain($metatags[$metatag]['label']) . ':',
check_plain($value['value']),
);
}
$value['value'] is not always a string, when $value['value'] is an array drupal throws an error message:
Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1559 of /var/www/example.com/includes/bootstrap.inc).
The specific case is when at least one "Robots" meta tag is set (nosnippet, noindex, nofollow, noarchive, noodp).
Fixing this bug would also allow to display the "Robots" values on the configuration preview.
Currently I've used a simple dirty fix like this:
foreach ($config->config as $metatag => $value) {
if (is_array($value['value'])){
$summary[] = array(
check_plain($metatags[$metatag]['label']) . ':',
check_plain(str_replace(", 0", "",implode(", ",$value['value']))),
);
} else {
$summary[] = array(
check_plain($metatags[$metatag]['label']) . ':',
check_plain($value['value']),
);
}
}
What do you think about?
Thanks
Comments
Comment #1
finex commentedComment #2
finex commentedWhen no Robots settings are checked the "Robots" preview shouldn't be printed.
or
Comment #3
dave reidThis has already been fixed in the latest code.
Comment #4
finex commented@Dave: I've just found the fix in -dev and I was being to close this report by myself... you're too quick :-) :-) :-) :-) :-)