Problem/Motivation
When running module updates after upgrading from 8.x-2.16 to 8.x-2.18 (as part of core upgrade to 10.2.7), the update fails due to two errors:
ArgumentCountError: Too few arguments to function Drupal\mysql\Driver\Database\mysql\Schema::addIndex(), 3 passed in /var/www/html/web/modules/contrib/visitors/visitors.install on line 1072 and exactly 4 expected in /var/www/html/web/core/modules/mysql/src/Driver/Database/mysql/Schema.php on line 571 #0 /var/www/html/web/modules/contrib/visitors/visitors.install(1072): Drupal\mysql\Driver\Database\mysql\Schema->addIndex('visitors', 'visitors_uid', Array)
ArgumentCountError: Too few arguments to function Drupal\mysql\Driver\Database\mysql\Schema::addIndex(), 3 passed in /var/www/html/web/modules/contrib/visitors/visitors.install on line 1204 and exactly 4 expected in /var/www/html/web/core/modules/mysql/src/Driver/Database/mysql/Schema.php on line 571 #0 /var/www/html/web/modules/contrib/visitors/visitors.install(1204): Drupal\mysql\Driver\Database\mysql\Schema->addIndex('visitors', 'bot', Array)
app-1 | #1 /var/www/html/web/core/includes/update.inc(171): visitors_update_8217(Array)
Proposed resolution
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Database%...
This isn't a resolution - someone would need to understand the '$fields' argument and how it might apply in this context to be able to propose a full resolution... but I was able to 'fix' the issues by temporarily editing visitors/visitors.install to add a ', null,' as the third argument ($fields) of both calls to schema()->addIndex(). This allowed the update to proceed without further issues. I suspect the many calls to addIndex (all with 3 arguments) will lead to similar problems in future.
Issue fork visitors-3454296
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
lightweight commentedComment #3
bluegeek9 commentedThank you for reporting this bug. I hope to have a fix soon.
Comment #4
bluegeek9 commentedComment #7
bluegeek9 commentedComment #8
bluegeek9 commentedhttps://www.drupal.org/project/visitors/releases/8.x-2.19