Deploy fail - Fatal error: Class Dotenv

After bedrock update on my second site I have a problem with deploy.

  1. I’ve updated composer to 2.0.8 and dependencies via vagrant ssh with provision
  2. In Trellis I’ve deleted hirak/prestissimo from group_vars/all/main.yml and I keep composer_keep_updated: true
  3. Repo updated
  4. ansible provision without fail

This is strange on my fist site with trellis after bedrock update and the same above steps deploy works fine.

did someone have a similar problem?

Loading composer repositories with package information Installing
dependencies from lock file Package operations: 11 installs, 6 updates, 0
removals - Updating composer/installers (v1.9.0 => v1.10.0): Loading from
cache - Updating roots/wordpress-core-installer (1.1.0 => 1.100.0): Loading
from cache - Installing symfony/polyfill-php80 (v1.22.0): Loading from cache
- Installing symfony/polyfill-mbstring (v1.22.0): Loading from cache -
Updating symfony/polyfill-ctype (v1.18.1 => v1.22.0): Loading from cache -
Installing graham-campbell/result-type (v1.0.1): Loading from cache -
Updating vlucas/phpdotenv (v4.1.8 => v5.2.0): Loading from cache - Updating
ffraenz/private-composer-installer (v4.0.0 => v5.0.1): Loading from cache -
Updating roots/bedrock-autoloader (1.0.3 => 1.0.4): Loading from cache -
Installing advanced-custom-fields/advanced-custom-fields-pro (5.9.4): PHP
Fatal error: Class Dotenv\Repository\Adapter\ArrayAdapter contains 4 abstract
methods and must therefore be declared abstract or implement the remaining
methods (Dotenv\Repository\Adapter\ReaderInterface::get,
Dotenv\Repository\Adapter\AvailabilityInterface::isSupported,
Dotenv\Repository\Adapter\WriterInterface::set, ...) in /srv/www/dev.io/releases/20210118114746/vendor/vlucas/phpdotenv/src/Repository/Adapter/
ArrayAdapter.php on line 10
fatal: [64.225.98.141]: FAILED! => {"changed": false, "stdout": "Loading composer repositories with package information\nInstalling dependencies from lock file\nPackage operations: 11 installs, 6 updates, 0 removals\n  - Updating composer/installers (v1.9.0 => v1.10.0): Loading from cache\n  - Updating roots/wordpress-core-installer (1.1.0 => 1.100.0): Loading from cache\n  - Installing symfony/polyfill-php80 (v1.22.0): Loading from cache\n  - Installing symfony/polyfill-mbstring (v1.22.0): Loading from cache\n  - Updating symfony/polyfill-ctype (v1.18.1 => v1.22.0): Loading from cache\n  - Installing graham-campbell/result-type (v1.0.1): Loading from cache\n  - Updating vlucas/phpdotenv (v4.1.8 => v5.2.0): Loading from cache\n  - Updating ffraenz/private-composer-installer (v4.0.0 => v5.0.1): Loading from cache\n  - Updating roots/bedrock-autoloader (1.0.3 => 1.0.4): Loading from cache\n  - Installing advanced-custom-fields/advanced-custom-fields-pro (5.9.4): PHP Fatal error:  Class Dotenv\\Repository\\Adapter\\ArrayAdapter contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (Dotenv\\Repository\\Adapter\\ReaderInterface::get, Dotenv\\Repository\\Adapter\\AvailabilityInterface::isSupported, Dotenv\\Repository\\Adapter\\WriterInterface::set, ...) in /srv/www/dev.io/releases/20210118114746/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php on line 10\n", "stdout_lines": ["Loading composer repositories with package information", "Installing dependencies from lock file", "Package operations: 11 installs, 6 updates, 0 removals", "  - Updating composer/installers (v1.9.0 => v1.10.0): Loading from cache", "  - Updating roots/wordpress-core-installer (1.1.0 => 1.100.0): Loading from cache", "  - Installing symfony/polyfill-php80 (v1.22.0): Loading from cache", "  - Installing symfony/polyfill-mbstring (v1.22.0): Loading from cache", "  - Updating symfony/polyfill-ctype (v1.18.1 => v1.22.0): Loading from cache", "  - Installing graham-campbell/result-type (v1.0.1): Loading from cache", "  - Updating vlucas/phpdotenv (v4.1.8 => v5.2.0): Loading from cache", "  - Updating ffraenz/private-composer-installer (v4.0.0 => v5.0.1): Loading from cache", "  - Updating roots/bedrock-autoloader (1.0.3 => 1.0.4): Loading from cache", "  - Installing advanced-custom-fields/advanced-custom-fields-pro (5.9.4): PHP Fatal error:  Class Dotenv\\Repository\\Adapter\\ArrayAdapter contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods (Dotenv\\Repository\\Adapter\\ReaderInterface::get, Dotenv\\Repository\\Adapter\\AvailabilityInterface::isSupported, Dotenv\\Repository\\Adapter\\WriterInterface::set, ...) in /srv/www/dev.io/releases/20210118114746/vendor/vlucas/phpdotenv/src/Repository/Adapter/ArrayAdapter.php on line 10"]}

vlucas/phpdotenv is upgraded from v4.1.8 to v5.2.0. It contains breaking changes.
See: https://github.com/roots/bedrock/pull/563

1 Like

Thanks for your reply, I’ve tried with it, I’ve replaced all bedrock files + new composer.lock file
All day I can’t figure out where is the issue,

Still the same error. I don’t understand what I am missing …

my bedrock composer.json

  "require": {
    "php": ">=7.1",
    "composer/installers": "^1.8",
    "vlucas/phpdotenv": "^5.2",
    "oscarotero/env": "^2.1",
    "roots/bedrock-autoloader": "^1.0",
    "roots/wordpress": "5.6",
    "roots/wp-config": "1.0.0",
    "roots/wp-password-bcrypt": "1.0.0",
    "wpackagist-plugin/safe-svg": "^1.9.9",
    "wpackagist-plugin/custom-post-type-ui": "^1.8.2",
    "wpackagist-plugin/contact-form-7": "^5.3.2",
    "sybrew/the-seo-framework": "^4.1.3",
    "advanced-custom-fields/advanced-custom-fields-pro": "^5.9.3",
    "wpackagist-plugin/post-smtp": "^2.0.16",
    "wpml/wpml-multilingual-cms": "*"
  },

Too complicated to work with composer 2 and trellis. No idea where was the issue. I had a bedrock backup so I’ve changed trellis composer update to false with hirak/prestissimo included. And deploy works again.

Look into code that use vlucas/phpdotenv, ensure they are compliable with vlucas/phpdotenv version 5.
Tips: Start with ffraenz/private-composer-installer

Too complicated to work with composer 2 and trellis.

Trellis or not doesn’t matter. Issues are on the PHP side.

I’m trying to update my existing bedrock environment from 1.14.4 to 1.15.2 and bump all my vendor plugins.

So, I got actually the same issue with composer 1.10.17: it fails while updating ACF-PRO using ffraenz/private-composer-installer

As well, I tried to:

  • remove site/vendor folder
  • remove composer.lock file
  • clear cache via composer clear-cache both local and remote environment using ssh

Checked all dependencies but with no luck.

This topic was automatically closed after 42 days. New replies are no longer allowed.