Drupal Commerce API installation failed - TypeError: strpos() expects parameter 1 to be string

13 views Asked by At

I have installed Drupal commerce on Druapl 8 site. I need to expose commerce features via an API. when I try to enable Commerce API module I am getting following error.

TypeError: strpos() expects parameter 1 to be string, int given in strpos() (line 33 of /var/www/html/web/modules/contrib/commerce_api/src/ParamConverter/EntityUuidConverter.php)

1

There are 1 answers

0
MavenSanK On

I have updated modules/contrib/commerce_api/src/ParamConverter/EntityUuidConverter.php file as follows.

$name to strval($name)

public function applies($definition, $name, Route $route) {
    return strpos(strval($name), 'commerce_') === 0;
}

Commerce API got enabled.