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

Command icon 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

mtift created an issue. See original summary.

nruest’s picture

I'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)."]}

transmitter’s picture

I'm seeting the same error on a 9.5 page.

andyo99’s picture

+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).

zenimagine’s picture

I confirm the problem with version 1.20

zenimagine’s picture

Version: 2.0.x-dev » 8.x-1.x-dev
Priority: Normal » Major
shelane’s picture

This was introduced in 1.16, so we need to need to figure out what combination of php and Drupal versions this breaks in.

vojta’s picture

I see it with PHP 8.0.27 and Drupal 9.5.2.

promes’s picture

I see it with PHP 8.0.27 and Drupal 9.5.2 as well.

ulfg’s picture

We have it as well on at least two sites
PHP 8.1.14
Drupal version : 9.5.2
Matomo 8.x-1.20

Grimreaper made their first commit to this issue’s fork.

grimreaper’s picture

Hi,

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.

grimreaper’s picture

Status: Active » Needs review

Please test the MR.

quotientix’s picture

Drupal 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.

nruest’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Priority: Major » Normal
Status: Needs review » Active

Tested the MR, and it clears up the issue on my end. Thank you!

steveoriol’s picture

Yes, I confirm that the MR41 is needed.

  • shelane committed 729dc4c4 on 8.x-1.x authored by Grimreaper
    Issue #3334982 by Grimreaper, nruest, mtift: Enabling Matomo display...

  • shelane committed 62c154c3 on 2.0.x authored by Grimreaper
    Issue #3334982 by Grimreaper, nruest, mtift: Enabling Matomo display...
shelane’s picture

Version: 2.0.x-dev » 8.x-1.20
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.