- Issue created by @mscweb
Statistics counter throws a type error regarding StatisticsCounterSubscriber.php
TypeError: Cannot access offset of type array on array i Drupal\Core\Database\Query\Merge->key() (rad 331 av /data/6/1/61bcdcb7-8db6-481a-b0bf-b7b805822688/tfrebell.se/tfrebell.se/web/core/lib/Drupal/Core/Database/Query/Merge.php)
Error traced to code from line 45:
Database::getConnection('default')->merge('node_counter')
->key('nid', $node->id())
->fields([
'weekcount' => 1,
'monthcount' => 1,
'yearcount' => 1,
])
->expression('weekcount', 'weekcount + 1')
->expression('monthcount', 'monthcount + 1')
->expression('yearcount', 'yearcount + 1')
->execute();
Seems to be similar to this issue π Fatal error when creating a rule using the "Set a user expiration date" action Active where specifically the last part from the MR on that issue where the key is changed
->key(['uid' => $user->id()])
->key('uid', $user->id())
Seems to resolve the issue in StatisticsCounterSubscriber.php, changing:
->key(['nid' => $node->id()])
to
->key('nid', $node->id())
Active
1.0
Code