composer-patches
composer-patches copied to clipboard
[ErrorException] count(): Parameter must be an array or an object that implements Countable
Hi, I am trying to apply patch but getting error. It works well on local but not on server.
Server php version (7.4.11) Server Composer version (1.10.21) cweagans/composer-patches (1.7.0)
Composer.json
{
"name": "drupal/legacy-project",
"description": "Project template for Drupal 9 projects with composer following drupal/drupal layout",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "package",
"package": {
"name": "woocommerce/flexslider",
"version": "2.7.2",
"type": "drupal-library",
"source": {
"url": "https://github.com/woocommerce/FlexSlider.git",
"type": "git",
"reference": "2.7.2"
}
}
},
{
"type": "package",
"package": {
"name": "harvesthq/chosen",
"version": "1.8.7",
"type": "drupal-library",
"dist": {
"url": "https://github.com/harvesthq/chosen/releases/download/v1.8.7/chosen_v1.8.7.zip",
"type": "zip"
},
"require": {
"composer/installers": "^1.2.0"
}
}
},
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.9",
"cweagans/composer-patches": "1.7.0",
"drupal/admin_toolbar": "^3.0",
"drupal/better_exposed_filters": "5.0-beta1",
"drupal/better_social_sharing_buttons": "^3.1",
"drupal/bootstrap": "^3.23",
"drupal/cache_control_override": "1.0-alpha2",
"drupal/chosen": "^3.0",
"drupal/commerce": "^2.24",
"drupal/commerce_cart_api": "^1.5",
"drupal/commerce_checkout_order_fields": "^1.1",
"drupal/core-composer-scaffold": "^9.1",
"drupal/core-project-message": "^9.1",
"drupal/core-recommended": "^9.1",
"drupal/core-vendor-hardening": "^9.1",
"drupal/devel": "^4.1",
"drupal/devel_kint_extras": "^1.0",
"drupal/direct_checkout_by_url": "^1.1",
"drupal/flexslider": "^2.0",
"drupal/fontawesome": "^2.18",
"drupal/google_tag": "^1.4",
"drupal/inline_entity_form": "1.0.0-rc8",
"drupal/login_emailusername": "^1.2",
"drupal/metatag": "^1.16",
"drupal/mobile_detect": "^2.5",
"drupal/pathauto": "^1.8",
"drupal/smtp": "^1.0",
"drupal/twig_tweak": "^3.0",
"drupal/views_extras": "^2.0@alpha",
"drupal/views_taxonomy_term_name_into_id": "^1.0@alpha",
"drupal/xmlsitemap": "^1.0",
"drush/drush": "8.*",
"kint-php/kint": "^3.3",
"razorpay/razorpay": "2.0.0",
"woocommerce/flexslider": "~2.0"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
},
"file-mapping": {
"[web-root]/sites/development.services.yml": false
}
},
"installer-paths": {
"core": [
"type:drupal-core"
],
"libraries/{$name}": [
"type:drupal-library"
],
"modules/contrib/{$name}": [
"type:drupal-module"
],
"profiles/contrib/{$name}": [
"type:drupal-profile"
],
"themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"modules/custom/{$name}": [
"type:drupal-custom-module"
],
"profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"patches": {
"composer-exit-on-patch-failure": true,
"drupal/flexslider":{
"Responsive Min and Max items": "https://www.drupal.org/files/issues/2020-08-09/responsive_minItems_and_maxItems_multiple_columns_per_slide-2844208-14.patch"
}
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/legacy-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}
When i am running composer install getting error
- Installing drupal/flexslider (2.0.0): Loading from cache
- Applying patches for drupal/flexslider
https://www.drupal.org/files/issues/2020-08-09/responsive_minItems_and_maxItems_multiple_columns_per_slide-2844208-14.patch (Responsive Min and Max items)
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2020-08-09/responsive_minItems_and_maxItems_multiple_columns_per_slide-2844208-14.patch
When running composer install -vvv
Installs: drupal/flexslider:2.0.0
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
[ErrorException]
count(): Parameter must be an array or an object that implements Countable
Exception trace:
() at /home/u622947679/domains/xyz.com/public_html/vendor/cweagans/composer-patches/src/Patches.php:207
I am not sure why patches are getting failed on server? Is it because of composer version? Any suggestion will helpful.
The same problem with install patch: PHP 7.3.28 Composer version 1.10.22 cweagans/composer-patches (1.7.1)
UPD: Looks like problem with composer-exit-on-patch-failure. Move this one from patches section like:
...
"composer-exit-on-patch-failure": true,
"patches": {
"drupal/flexslider":{
"Responsive Min and Max items": "https://www.drupal.org/files/issues/2020-08-09/responsive_minItems_and_maxItems_multiple_columns_per_slide-2844208-14.patch"
}
},
...
Thanks @yaroslav-zenin for help.
Looks like a bad patch. Also, main doesn't resolve patches from dependencies anymore.