Skip to content

Commit 91d48cb

Browse files
committed
fix: parse flag old php
1 parent b227b80 commit 91d48cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Loader.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ public function load($file, $override = false, $mode = self::PUTENV)
4949
throw new \InvalidArgumentException('The .env file does not exist or is not readable');
5050
}
5151

52+
5253
// Get file contents, fix the comments, quote the values and parse as ini.
5354
$content = \preg_replace('/^\s*#/m', ';', \file_get_contents($file));
5455
$content = \preg_replace('/=([^"\r?\n].*)$/Um', '="$1"', $content);
55-
$parsed = \parse_ini_string($content, false, \INI_SCANNER_TYPED);
56+
57+
$flag = defined('INI_SCANNER_TYPED') ? \INI_SCANNER_TYPED : \INI_SCANNER_NORMAL;
58+
$parsed = \parse_ini_string($content, false, $flag);
5659

5760
if ($parsed === false) {
5861
throw new \RuntimeException('The .env file cannot be parsed due to malformed values');

0 commit comments

Comments
 (0)