Skip to content

Commit e2463a3

Browse files
committed
bug #503 [Examples] Fix env() function to check for empty string values (OskarStark)
This PR was merged into the main branch. Discussion ---------- [Examples] Fix `env()` function to check for empty string values | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | -- | License | MIT The env() function now checks both isset() and empty string to properly handle environment variables defined in .env but with empty values. Commits ------- ee068ab Fix env() function to check for empty string values
2 parents 0abf5e3 + ee068ab commit e2463a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
function env(string $var)
2727
{
28-
if (!isset($_SERVER[$var])) {
28+
if (!isset($_SERVER[$var]) || '' === $_SERVER[$var]) {
2929
printf('Please set the "%s" environment variable to run this example.', $var);
3030
exit(1);
3131
}

0 commit comments

Comments
 (0)