Problem/Motivation
I successfully upgraded Matomo to 1.20 on 3 websites without problem. However, on the fourth site, it caused a PHP fatal error under.
Steps to reproduce
1. Enable/upgrade to Matomo 1.20
2. Enable the Matomo Display extender on /admin/structure/views/settings/advanced
3. Try to load any page and see the following errors:
PHP Fatal error: Uncaught TypeError: Cannot assign null to property Drupal\matomo\Plugin\views\display_extender\Matomo::$facetsManager of type Drupal\facets\FacetManager\DefaultFacetManager in /web/modules/contrib/matomo/src/Plugin/views/display_extender/Matomo.php:54
Stack trace:
#0 /web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\matomo\Plugin\views\display_extender\Matomo::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'matomo', Array)4. Uncheck the box to allow the site to function again.
NOTE: I cannot reproduce this error locally (PHP 8.1.2) and I only see it on one production site (running PHP 8.1.9). I don't see anything obviously wrong with the code on line 54, but I thought I'd open this just in case others encounter it, too.
Issue fork matomo-3334982
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nruest commentedI'm getting the same error when trying to enable with 1.20 and 1.19 of the module on 9.5, 9.4, and 9.1 fresh installs.
"TypeError: Cannot assign null to property Drupal\\matomo\\Plugin\\views\\display_extender\\Matomo::$facetsManager of type Drupal\\facets\\FacetManager\\DefaultFacetManager in Drupal\\matomo\\Plugin\\views\\display_extender\\Matomo::create() (line 54 of /var/www/html/drupal/web/modules/contrib/matomo/src/Plugin/views/display_extender/Matomo.php)."]}Comment #3
transmitter commentedI'm seeting the same error on a 9.5 page.
Comment #4
andyo99 commented+1
seeing this on one site having upgraded another no problem (on same host, both running D9.5.2 & PHP 8.1.14):
The website encountered an unexpected error. Please try again later.
TypeError: Cannot assign null to property Drupal\matomo\Plugin\views\display_extender\Matomo::$facetsManager of type Drupal\facets\FacetManager\DefaultFacetManager in Drupal\matomo\Plugin\views\display_extender\Matomo::create() (line 54 of modules/contrib/matomo/src/Plugin/views/display_extender/Matomo.php).
Comment #5
zenimagine commentedI confirm the problem with version 1.20
Comment #6
zenimagine commentedComment #7
shelaneThis was introduced in 1.16, so we need to need to figure out what combination of php and Drupal versions this breaks in.
Comment #8
vojta commentedI see it with PHP 8.0.27 and Drupal 9.5.2.
Comment #9
promesI see it with PHP 8.0.27 and Drupal 9.5.2 as well.
Comment #10
ulfg commentedWe have it as well on at least two sites
PHP 8.1.14
Drupal version : 9.5.2
Matomo 8.x-1.20
Comment #12
grimreaperHi,
The Drupal version is not important.
It is due to the optional support of the Facets module and using one of its service that may not be present.
Strong typing is preventing the NULL.
Comment #14
grimreaperPlease test the MR.
Comment #15
quotientix commentedDrupal 9.5.2 and Matomo 1.20, PHP 8.1.13 breaks the site for me.
Rerolled to 1.19 to get it back up running.
Comment #16
nruest commentedTested the MR, and it clears up the issue on my end. Thank you!
Comment #17
steveoriolYes, I confirm that the MR41 is needed.
Comment #20
shelane