Description
- Laravel Version: 5.8.5
- PHP Version: 7.2.12
- Database Driver & Version: n/a
Description:
When upgrading our applications to use Laravel v5.8 there is a major breaking change in the way environment variables are being handled which renders useless the majority of third-party composer libraries that use PHP's getenv
function.
This change is documented here: https://laravel.com/docs/5.8/upgrade which is great, and which we are using to upgrade our systems. Unfortunately this guide does not cover the actual change that was made in the underlying way the Dotenv library is being used. For whatever reason the adapter that was being used to populate the environment that getenv
uses is no longer being loaded. This is a huge breaking change that effects an entire ecosystem of third-party libraries when being used with Laravel.
There was an issue raised here which was recently closed: #27913 In that issue, the response was to use the Laravel env
helper instead of PHP's getenv
function. This is good advice for Laravel applications where you are in control of all code but for third-party composer libraries this is not possible. There are literally thousands of libraries out there that have no idea they are being used with Laravel and use getenv
internally.
What this ultimately means is that it's impossible for us to upgrade any of our applications to Laravel 5.8 while this is broken.
Steps To Reproduce:
Use any code (including any third-party composer library) that uses getenv
to load an environment variable from the .env
file. It always returns false
.