Just tested Google Analytics migration from D7 to D8 and after the migration completed I got this message. I need to say that this is not my fault in GA. I have only seen this after the Drupal migration completed and no where else.
Upgrade process not completed
Review the detailed upgrade log
Warning: strip_tags() expects parameter 1 to be string, object given in google_analytics_page_attachments() (line 150 of modules\google_analytics\google_analytics.module).
The error comes from this code Json::encode(strip_tags($message)):
foreach (drupal_get_messages(NULL, FALSE) as $type => $messages) {
// Track only the selected message types.
if (in_array($type, $message_types)) {
foreach ($messages as $message) {
// @todo: Track as exceptions?
$message_events .= 'ga("send", "event", ' . Json::encode(t('Messages')) . ', ' . Json::encode($status_heading[$type]) . ', ' . Json::encode(strip_tags($message)) . ');';
}
}
}
A message need to be TEXT only and cannot be a OBJECT. I guess the migration UI or Core has a bug.
Comments
Comment #2
hass commentedComment #3
jibranIt is supposed to return
stringorMarkupInterfacewhich has__toStringdid you try typecasting the it to string?Comment #4
hass commentedNo idea how I‘m able to reproduce this situation. I expect string only and do not typecast something that should only be a string.
Based on https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/functi... I think this can only a sring. No word about MarkupInterface.
Comment #5
hass commentedFound it. This bad behaviour is new in D8. https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/functi.... An unseen bug for more than 3.5 years.
Comment #6
hass commentedComment #7
hass commentedComment #10
hass commentedComment #11
hass commentedComment #12
hass commented