Current Behavior:
The parseEnvFile() function currently checks if a line starts with # using str_starts_with($line, '#'). If the line contains leading whitespace before the #, such as in lines like # something like = this, this check fails and the line is not treated as a comment, potentially leading to incorrect parsing.
Expected Behavior:
The function should trim leading whitespace (ltrim) from each line before checking if it starts with #. This will ensure that lines with spaces or tabs before the # are correctly identified as comments and ignored by the parser.
Additional Context:
This adjustment will improve compatibility with .env files where users may add spaces before comments, preventing unexpected false positives and parsing errors.
Current Behavior:
The
parseEnvFile()function currently checks if a line starts with#usingstr_starts_with($line, '#'). If the line contains leading whitespace before the#, such as in lines like# something like = this, this check fails and the line is not treated as a comment, potentially leading to incorrect parsing.Expected Behavior:
The function should trim leading whitespace (ltrim) from each line before checking if it starts with
#. This will ensure that lines with spaces or tabs before the#are correctly identified as comments and ignored by the parser.Additional Context:
This adjustment will improve compatibility with
.envfiles where users may add spaces before comments, preventing unexpected false positives and parsing errors.