Skip to content

Commit d5b91bc

Browse files
Merge branch 'master' into 6.0
2 parents fb4f0f5 + 355135f commit d5b91bc

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"tightenco/collect": "^5.0",
6262
"phpseclib/phpseclib": "^2.0",
6363
"softlayer/objectstorage": "dev-master",
64-
"vlucas/phpdotenv": "^3.0",
64+
"vlucas/phpdotenv": "^4.0",
6565
"google/apiclient":"^2.0",
6666
"php-opencloud/openstack": "^3.0",
6767
"arhitector/yandex": "^2.0",
@@ -76,7 +76,7 @@
7676
"phpseclib/phpseclib": "Require '^2.0' to use SFTP sync",
7777
"softlayer/objectstorage": "Require 'dev-master' to sync to Softlayer",
7878
"php-opencloud/openstack": "Require ^3.0 to sync to OpenStack",
79-
"vlucas/phpdotenv": "Require ^3.0 to use Dotenv adapter",
79+
"vlucas/phpdotenv": "Require ^3.0 or ^4.0 to use the Dotenv adapter",
8080
"google/apiclient":"Require ^2.0 to sync to Google Drive",
8181
"arhitector/yandex":"Require ^2.0 to sync to Yandex Disk",
8282
"microsoft/azure-storage-blob": "Require ^1.4 to sync to Azure Blob Storage"

src/Adapter/Dotenv.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ public function setup(array $conf)
4343
{
4444
$path = AppUtil\Arr::getValue($conf, 'file', '.env');
4545
$this->file = AppUtil\Path::toAbsolutePath($path, Configuration::getWorkingDirectory());
46-
$this->dotenv = DotenvLib::create(dirname($this->file), basename($this->file));
46+
47+
// dotenv version 4 and higher
48+
if (method_exists('Dotenv\\Dotenv','createImmutable')) {
49+
$this->dotenv = DotenvLib::createImmutable(dirname($this->file), basename($this->file));
50+
} else {
51+
$this->dotenv = DotenvLib::create(dirname($this->file), basename($this->file));
52+
}
4753
$this->dotenv->load();
4854
}
4955

0 commit comments

Comments
 (0)