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

Remove getenv by using _env and $_ENV instead #25

Merged
merged 4 commits into from
Oct 1, 2024

Conversation

myteril
Copy link
Contributor

@myteril myteril commented Oct 1, 2024

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

Description

The getenv function is not thread-safe. (See vlucas/phpdotenv#putenv-and-getenv) It breaks the core functionality of web sites.

In this pull request, I have removed getenv and made the module use Leaf's _env function instead to get environment variables. The change ensures that the functionality of this module does not break if you merge leafsphp/leaf#253 with the default branch of the main repo.

I could not run the tests. The credentials are not valid.

I didn't check all Leaf modules for getenv, but all of its occurrences in modules should be replaced with _env and $_ENV.

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Related Pull Request

leafsphp/leaf#253

Copy link
Member

@mychidarko mychidarko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @myteril

@mychidarko mychidarko merged commit 6cef68d into leafsphp:next Oct 1, 2024
0 of 8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants