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

Expose the Lambda context in LAMBDA_INVOCATION_CONTEXT in all runtimes #1686

Merged
merged 2 commits into from
Jan 1, 2024

Conversation

mnapoli
Copy link
Member

@mnapoli mnapoli commented Nov 8, 2023

Follow-up of #1685 that reverted #1668. This is a different implementation.

private function setEnv(string $name, string $value): void
{
$_SERVER[$name] = $_ENV[$name] = $value;
if (! putenv("$name=$value")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have to use putenv?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's in case a user is using getenv.

Do you see any issue? It's not like we're doing multithreading.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeh, I still don't like it. Why do people even use getenv? I assume it's just because PHP named things in a way that's super confusing, and people reach for it as "the way to read env variables", even though $_SERVER is actually the closest approximation to "the list of env variables".

Copy link
Member Author

Choose a reason for hiding this comment

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

If the argument is "I don't like it" that's not enough for me :p 😈

I agree this isn't the best, but might as well support it if anyone uses it.

@mnapoli mnapoli merged commit 65b318a into master Jan 1, 2024
8 checks passed
@mnapoli mnapoli deleted the lambda-context branch January 1, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants