Skip to content

Commit f3bbf18

Browse files
committed
fix(bootstrap): remove redundant type conversion loop
Let Env library handle all type conversions to avoid implicit casting issues when calling env()
1 parent e7e19e1 commit f3bbf18

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

bootstrap.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,6 @@ function fixMissingEnvVars(
115115
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__, $envs, false);
116116
$dotenv->load();
117117
$dotenv->required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASSWORD']);
118-
119-
// https://github.com/vlucas/phpdotenv/issues/231#issuecomment-663879815
120-
foreach ($_ENV as $key => $val) {
121-
if (ctype_digit((string) $val)) {
122-
$dotenv->required($key)->isInteger();
123-
$_ENV[$key] = (int) $val;
124-
} elseif (!empty($val) && !is_numeric($val) && ($newVal = filter_var($_ENV[$key], \FILTER_VALIDATE_BOOLEAN, \FILTER_NULL_ON_FAILURE)) !== null) {
125-
$dotenv->required($key)->isBoolean();
126-
$_ENV[$key] = $newVal;
127-
} elseif (empty($val) || 'null' === mb_strtolower((string) $val, 'UTF-8')) {
128-
$_ENV[$key] = null;
129-
}
130-
}
131118
} catch (Exception $e) {
132119
// https://github.com/phpro/grumphp/blob/master/doc/tasks/phpparser.md#no_exit_statements
133120
exit($e->getMessage());

0 commit comments

Comments
 (0)