Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After using successfully similarterms module locally I exported the configs to deploy them to production environment. When executing drush cim I got following error
PHP Fatal error: Declaration of Drupal\similarterms\Plugin\views\argument\SimilarTermsArgument::query() must be compatible with Drupal\views\Plugin\views\argument\NumericArgument::query($group_by = false) in /my-web-path/modules/contrib/similarterms/src/Plugin/views/argument/SimilarTermsArgument.php on line 19
So I noticed that the src/Plugin/views/argument/SimilarTermsArgument.php query() function was missing an argument.
Previous
/**
* Add filter(s).
*/
public function query() {
$this->ensureMyTable();
....
New
/**
* Add filter(s).
*/
public function query($group_by = FALSE) {
$this->ensureMyTable();
....
So adding the $group_by argument to query function fixed the issue and drush cim started working after applying the patch.
Comment | File | Size | Author |
---|---|---|---|
#2 | error-2930185.png | 15.96 KB | deepakrmklm |
query.patch | 593 bytes | MikaT |
Comments
Comment #2
deepakrmklm CreditAttribution: deepakrmklm at Zyxware Technologies commentedHello,
Patch works fine in Drupal 8.45.
+1 RTBC
Thanks,
Deepak R
Comment #3
nedjoThis is indeed a major issue and the proposed fix is correct.
SimilarTermsArgument
extendsNumericArgument
and the method signature forNumericArgument::query()
indeed includes the$group_by = FALSE
argument and default value.Comment #4
mlncn CreditAttribution: mlncn at Agaric for Drutopia, National Institute for Children's Health Quality, MASS Design Group, Portside commentedDitto on the RTBC. I ran into this issue on an install (extra configuration step) of an installation profile that included Similar by Terms, and the patch fixes it.
Comment #5
arnested CreditAttribution: arnested at Reload commentedRTBC from me as well.
Raising priority to critical because this renders the site unusable from PHP 7.2.
Comment #6
nedjoAdding the PHP 7.2 tag.
Comment #7
lias CreditAttribution: lias commented+1 patch fixed error when updating from PHP 5.6 to 7.2 - Drupal 8.6.5
Comment #8
rgpublicYes, we all know the patch works by now, I guess. If you look at the patch it's so simple, I wouldnt think anyone could really doubt it's necessary. Now, as usual with Drupal, the big question is: How can we get this page here:
https://www.drupal.org/project/similarterms
to list a new version 1.4 (the currently listed 1.3 is from July 2016) with this patch included? I wonder in particular:
* Who exactly has the necessary permissions to push this change and release a new version? (One person? Multiple persons?)
* Are they still alive & responding to emails at all?
* If not: Who has the necessary permissions to transition this project to someone else to finally make the necessary changes?
Comment #9
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedRTBC++
Comment #10
Alex G CreditAttribution: Alex G as a volunteer commentedTo confirm patch still works fine for the latest 8.6.14 version of Drupal.
I've poked one of the maintainers to see if we can roll this out in a new version.
Imagine a majority of people will be moving over to PHP 72 of the course of this year if not already.
Comment #11
rgpublicOk, thanks. Let's see what happens. Otherwise I guess we'll have to follow this procedure:
https://www.drupal.org/node/251466
Comment #12
Alex G CreditAttribution: Alex G as a volunteer commentedI've had no reply from either maintainer. Someone will need to follow the process linked in #11 and get it rolled out.
Comment #13
tvalimaa CreditAttribution: tvalimaa commentedModule worked fine without patch Drupal core 8.7.6 & PHP 7.1. Confirm that patch works and needed Drupal core 8.7.6 & PHP 7.3.
Comment #14
sandeshyadav CreditAttribution: sandeshyadav commentedI faced the same the same issue after updating PHP from PHP7.0 to PHP7.2. The issue got resolved for me after I switched to PHP 7.1. I did not apply the patch. My Drupal version is 8.7.6. And Similar By Terms version 8.x-1.3.
Comment #15
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedJust to make sure that everyone knows where the fatal error applies.
Comment #17
ericpugh