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

Possible switch from getenv() to $_ENV() #3

Closed
petrpacas opened this issue Jul 17, 2017 · 5 comments
Closed

Possible switch from getenv() to $_ENV() #3

petrpacas opened this issue Jul 17, 2017 · 5 comments

Comments

@petrpacas
Copy link

petrpacas commented Jul 17, 2017

I'm currently using a shared webhost and as it turns out, they have putenv() (and consequently getenv()) disabled. And since your library is using getenv(), it doesn't work in that setup.

Since I might not be the only one to ever run into this issue, I wanted to ask whether your library could be updated to use $_ENV[] instead? I'm not very PHP-savvy, so, I might be asking the impossible here...

Thank you for your consideration.

(Link to related issue I posted in roots/bedrock.)

@oscarotero
Copy link
Owner

Interesting.
I've created a branch with a patch for this. Can you test it? If it works fine, I'll release the v1.1.0 tag

@petrpacas
Copy link
Author

petrpacas commented Jul 17, 2017

Sorry for the first reply - I didn't notice the need for adding the Env::USE_ENV_ARRAY option.

Env::init();
Env::$options = Env::USE_ENV_ARRAY;

After adding it it does work! Clever solution, Oscar 👏

Edit just in case:

Env::init();
Env::$options |= Env::USE_ENV_ARRAY;

@oscarotero
Copy link
Owner

Great.
Note that your configuration add only USE_ENV_ARRAY, but discard the default config. You should do this:

Env::$options |= Env::USE_ENV_ARRAY;

@petrpacas
Copy link
Author

petrpacas commented Jul 17, 2017

I was kind of hoping you'll correct me if needed - thank you again.

Would you think it is better to include it before or after the Env::init();? I tested that it is arbitrary, but still...

@oscarotero
Copy link
Owner

ok, new version released. Enjoy :)

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