it is only compatible with ^8.7.7 || ^9 which is in the composer file.

Comments

SocialNicheGuru created an issue. See original summary.

socialnicheguru’s picture

drush en commerce_funds
The following extensions will be enabled: commerce_funds
Do you really want to continue? (y/n): y
Symfony\Component\Validator\Exception\UnexpectedTypeException: Expected argument of type "array or Traversable and [error]
ArrayAccess", "string" given in
drupal-8.8/vendor/symfony/validator/Constraints/CollectionValidator.php:37

aporie’s picture

Status: Active » Closed (cannot reproduce)

Hi,

I don't see why your issue should be related to commerce_funds, it seems more than a composer dependency issue. I'd run composer update --with-dependencies to try to resolve it.

Regarding the drupal core version, according to this post core_requirement is not available before 8.7.7 and that's what is in the .info file.

I close the ticket because I wasn't able to reproduce. Feel free to comment, reopen or create a new ticket if needed.

socialnicheguru’s picture

Title: commerce_funds is incompatible with the Drupal version. Not compatible with Drupal 8.8 » commerce_funds causing: Expected argument of type "array or Traversable and ArrayAccess", "string" given
Status: Closed (cannot reproduce) » Active

In the error that I got

Symfony\Component\Validator\Exception\UnexpectedTypeException: Expected argument of type "array or Traversable and ArrayAccess", "string" given in
drupal-8.8/vendor/symfony/validator/Constraints/CollectionValidator.php:39

In debugging the string that caused the error was "^(\w|-)+$" which comes from the comemrce_funds module

grep -in -F "^(\w|-)+$" -d recurse *
contrib/commerce_funds/commerce_funds.routing.yml:53: request_hash: ^(\w|-)+$
contrib/commerce_funds/commerce_funds.routing.yml:62: request_hash: ^(\w|-)+$
contrib/commerce_funds/commerce_funds.routing.yml:98: method: ^(\w|-)+$
contrib/commerce_funds/commerce_funds.routing.yml:135: transaction_hash: ^(\w|-)+$
contrib/commerce_funds/commerce_funds.routing.yml:145: transaction_hash: ^(\w|-)+$

aporie’s picture

Did you composer update --with-dependencies ?

What's triggering the error are simple regex validators, I don't know why your Constraints/CollectionValidator is waiting for an array here.

I've tried on a fresh install this morning and didn't get any issue.

aporie’s picture

Status: Active » Closed (cannot reproduce)
wqmeng’s picture

Hello,

I also find this problem on the Drupal 10.1.4-dev. Here is the error.

What I have modification is to change the method parameter to be the following in the file
web/modules/contrib/commerce_funds/commerce_funds.routing.yml

But it will lose the regex validator, do not know how keep the validation if possible?

Thank you.

commerce_funds.withdrawal_methods.edit:
  path: '/user/{user}/withdrawal-methods/{method}/edit'
  defaults:
    _controller: '\Drupal\commerce_funds\Controller\WithdrawalMethods::editMethod'
    _title: 'Configure Withdrawal Methods'
    link_id: 'commerce_funds.withdrawal_methods.edit'
  requirements:
    _custom_access: '\Drupal\commerce_funds\Access\WithdrawalMethodAccessCheck::checkAccess'
  options:
    parameters:
      user:
        type: entity:user
      method:
        type: string
User warning: Error while validating the route parameter definition in item : This value should be of type array|(Traversable&ArrayAccess). Original data: '^(\\w|-)+$' in Drupal\plugin\ParamConverter\PluginDefinitionConverter->validateParameterDefinition() (line 136 of modules/contrib/plugin/src/ParamConverter/PluginTypeBasedConverterTrait.php).

Drupal\plugin\ParamConverter\PluginDefinitionConverter->validateParameterDefinition('^(\w|-)+$') (Line: 77)
Drupal\plugin\ParamConverter\PluginDefinitionConverter->applies('^(\w|-)+$', 'method', Object) (Line: 61)
Drupal\Core\ParamConverter\ParamConverterManager->setRouteParameterConverters(Object) (Line: 40)
Drupal\Core\EventSubscriber\ParamConverterSubscriber->onRoutingRouteAlterSetParameterConverters(Object, 'routing.route_alter', Object)
call_user_func(Array, Object, 'routing.route_alter', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'routing.route_alter') (Line: 189)
Drupal\Core\Routing\RouteBuilder->rebuild() (Line: 83)
Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild() (Line: 518)
drupal_flush_all_caches() (Line: 95)
Drupal\devel\Controller\DevelController->cacheClear()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
wqmeng’s picture

Status: Closed (cannot reproduce) » Active

Change the status to be active.

aporie’s picture

I'm getting some work done for a new release.

Reading this issue again, I'm pretty sure it's related to a payment method you are using.

Can I ask which ones you were using?

I'm revamping this route anyway as I mistakenly named a plugin "bank-account" while it should have been "bank_account".