Problem/Motivation

When upgrading a Drupal 8 site to Drupal 9, and running drush updatedb, I got this error:

Unable to decode output into JSON: Syntax error                                                               
                                                                                                                
  Fatal error: Declaration of Drupal\search_api\Processor\ConfigurablePropertyBase::setConfiguration(?array $c  
  onfiguration): Drupal\search_api\Processor\ConfigurablePropertyBase must be compatible with Drupal\search_ap  
  i\Processor\ConfigurablePropertyInterface::setConfiguration(?array $configuration): Drupal\search_api\Proces  
  sor\ConfigurablePropertyInterface in /........./web/modules/contrib/search_api/src/Processor/Con  
  figurablePropertyBase.php on line 11

Proposed resolution

I was able to get the updates to run by changing:

public function setConfiguration(?array $configuration): self;

to

public function setConfiguration(?array $configuration);

Not a PHP expert (still learning as a front-ender), so no idea why this works, just figured I'd share. Not sure if the issue was with Drush, my Drupal codebase, or this module.

Issue fork search_api-3355677

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

dalemoore created an issue. See original summary.

drunken monkey’s picture

Version: 8.x-1.29 » 8.x-1.x-dev
Component: General code » Framework
Status: Active » Needs review
StatusFileSize
new571 bytes

Thanks a lot for reporting this problem!
The attached patch should fix this. It seems we weren’t careful in our code to still keep compatible with PHP 7.3, the oldest version we officially support.
Please test/review!

However, the correct fix for you would be to update to a newer version of PHP, if at all possible. PHP 7.3 has been unsupported for over a year now, so running it constitutes a security risk for your site.

keshav.k made their first commit to this issue’s fork.

keshavv’s picture

Status: Needs review » Reviewed & tested by the community

I have tested the patch, Confirmed that this will solve the issue.
I have created the MR, So it can be merge easily.

dalemoore’s picture

Thanks. The updates were already performed so I don't know that I can test, but I applied the one-line fix and tried running updatedb and no errors.

  • drunken monkey committed 6ce3d21e on 8.x-1.x
    Issue #3355677 by drunken monkey: Fixed incompatibility with PHP 7.3 in...
drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

OK, the fix should be fine anyways. Still, thanks for providing feedback!
Committed.

PS: The error should probably also appear when navigating through the Search API admin UI. For instance, try adding a field to an index.

Status: Fixed » Closed (fixed)

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

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