I have a bedrock installation made couple of years ago (v.1.12.8 according to CHANGELOG.md, there’s no other place where I can check version number), and recently I wanted to get back to this project I noticed that upon making updates to some packages/plugins, Composer prompted me to update to version 2, which went just fine.
I wanted to see if the Capistrano deployment still works, and… here’s where the problems started. There were errors on deploy, but I found some threads here which eventually resulted in:
bumping composer/installers to ^1.9, in both the project and theme folders
bumping vlucas/phpdotenv to ^5.2, which installed v.5.4 which I realised isn’t yet merged, so eventually I downgraded to the latest merged version which is v.5.2.
removing “vendor” folder from project and theme folders
running “composer install && composer update”
However, now the problem is not with deployment but with the project itself. I am locally getting an error: Argument 1 passed to Dotenv\Dotenv::create() must be an instance of Dotenv\Repository\RepositoryInterface, string given...
Since I did update the vlucas/phpdotenv package, as described above, but my Bedrock version is from 2019 (1.12.8) – isn’t this the problem?
How do I update Bedrock? If that’s not required, where do I look to fix this?
Thanks!
Have you compared the code in your version of Bedrock to the latest? There are changes that you are required to make based on phpdotenv changes
Searching for the error message you provided came up with this topic which links to a GitHub PR - check out that code diff and make sure that you’ve got that change made to config/application.php
I can change config/application.php to the state the topic (which I have seen before) was pointing to (link) but now my instance cannot connect to database – showing the typical Wordpress page “Error establishing a database connection”.
I’ve tried using the very latestconfig/application.php but it creates some more problems – for instance the function Env\env is not recognized, and I clearly am not fluent enough to be able to fix it.
Sounds like you’re missing roots/wp-config and the changes that came with that.
There’s a few different approaches folks use… personally I overwrite all of the files in a project with the latest published release and look at the diff
Done, wasn’t that hard after all. Just a handful of files to be checked & updated, really!
I wasn’t sure about one additional mu-plugin (disallow-indexing.php, since I had it but it wasn’t in the original Bedrock package… but after running composer install it is still there and no problems whatsoever.
Deployment with Capistrano wasn’t affected by this update, so I’m happy about it too – tried on staging and eventually updated the production site too.