Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseConfig getEnvValue type juggling #67

Closed
mwhitneysdsu opened this issue Apr 21, 2016 · 2 comments
Closed

BaseConfig getEnvValue type juggling #67

mwhitneysdsu opened this issue Apr 21, 2016 · 2 comments
Milestone

Comments

@mwhitneysdsu
Copy link
Contributor

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.

@lonnieezell
Copy link
Member

Hey, Mat, good to hear from you!

But, dang, you're right. Good catch!

@mwhitneysdsu
Copy link
Contributor Author

I probably wouldn't have noticed it if it weren't for the update you made to convert 'false' to false, because that just sets off alarms in my head. Unfortunately, since getenv() returns false when it can't find the value, it leads us to the land of choosing between a series of bad options.

@lonnieezell lonnieezell added this to the Phase 1 milestone May 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants