After re-enabling this module after a site migration, the site was not working, the following message was printed in the logs:
Error: [] operator not supported for strings in replace_google_analytics_counter_tags() (line 220 of /var/www/html/web/sites/all/modules/contrib/google_analytics_counter/google_analytics_counter.module).
The following patch seems to have solved the issue. I've initialized the variables $matchlink, $orig_match and $matches as arrays instead of strings.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | operator-not-supported-for-strings-2980752-10.patch | 708 bytes | esod |
| google_analytics_counter-fix_replace_google_analytics_counter_tags.patch | 662 bytes | felubra |
Comments
Comment #2
felubraComment #3
felubraComment #4
ktch_my commentedI'm having the same error on Drupal 8 version of the module.
2 different server rule out PHP possibility.
Changing weight between Token Filter and GA Counter Token Filter in Text Formatter doesn't help.
Installed via composer ^3.0@alpha
Drupal 8.7
Error: [] operator not supported for strings in Drupal\google_analytics_counter\Plugin\Filter\GoogleAnalyticsCounterFilter->handleText() (line 121 of google_analytics_counter/src/Plugin/Filter/GoogleAnalyticsCounterFilter.php)Applied the D7 patches
And I get a lot of errors such as:
Notice: Undefined variable: original_match in Drupal\google_analytics_counter\Plugin\Filter\GoogleAnalyticsCounterFilter->handleText() (line 157 of modules/contrib/google_analytics_counter/src/Plugin/Filter/GoogleAnalyticsCounterFilter.php).Notice: Array to string conversion in Drupal\google_analytics_counter\Plugin\Filter\GoogleAnalyticsCounterFilter->handleText() (line 157 of modules/contrib/google_analytics_counter/src/Plugin/Filter/GoogleAnalyticsCounterFilter.php).Comment #6
vacilando commentedFYI: fixed in the D7 version.
Comment #7
felubraThanks!
Comment #8
esod commentedHi. I'll have a look at the Drupal 8.x version.
Comment #9
mazerrati commentedJust in case someone's still stuck with this...
For Drupal 8.x version, apply the patch to:
/modules/google_analytics_counter/src/Plugin/Filter/GoogleAnalyticsCounterFilter.php
Comment #10
esod commentedThanks for the patch. Here's the 8.x-3.x-dev patch.
Comment #12
kaszarobert