Skip to content

BaseConfig getEnvValue type juggling #67

Description

@mwhitneysdsu

For reference, the content of getEnvValue() currently looks like this:

if ($value = getenv("{$shortPrefix}.{$property}"))
        {
            return $value;
        }
        else if ($value = getenv("{$prefix}.{$property}"))
        {
            return $value;
        }
        else if ($value = getenv($property))
        {
            return $value;
        }

This would appear to prevent setting values such as 0, "0", an empty string, empty array, etc. You've worked around the boolean false by allowing conversion of the string 'false' in the constructor, but most of the other loose comparisons still apply within the getEnvValue() method itself. Fixing this would likely require three separate if comparisons using $value === false.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions