Skip to content

Fix #71868: Environment variables with no value are filtered out by proc_open() #7927

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

Closed
wants to merge 1 commit into from

Conversation

nradchenko
Copy link

Remove empty value check from _php_array_to_envp (introduced in 7e92f63)

…roc_open()

Remove empty value check from _php_array_to_envp (introduced in 7e92f63)
@cmb69
Copy link
Member

cmb69 commented Jan 11, 2022

Thank you for the PR! However, the legit test failures show that this change might break existing scripts and applications, so I'm generally reluctant to change any of the stable PHP versions in this regard. It is even debatable whether the current behavior is a bug or a feature, since programs are generally free to treat empty environment variables and unset environment variables the same. Maybe it is a good idea to write to the internals mailing list to ask for thoughts on this change.

@nradchenko
Copy link
Author

Good point.

It is even debatable whether the current behavior is a bug or a feature

I'm not 100% sure about this, so it's definitely needs more investigation. I'm aware that PHP test system uses proc_open, so it might need some tuning too.

Maybe it is a good idea to write to the internals mailing list to ask for thoughts on this change

Thanks for the hint! I'll also try to add a note about the current behavior to the documentation.

Can we leave this draft PR open? @cmb69

@cmb69
Copy link
Member

cmb69 commented Jan 11, 2022

Can we leave this draft PR open?

Sure. :)

@beberlei
Copy link
Contributor

An alternative could be to make this behavior opt-in with a new options flag pass_empty_environment_variables or something along these lines.

@crrodriguez
Copy link
Contributor

Empty values on the enviroment are ok.. I see valid usescases.
This one of the other bugs I did not fix in PR #7933 .

Other issues remain like
$env = array('=' => 'aeiou', '\0oops' => '\0oops');
which is a completely invalid environment to pass but there is no error.

  • having an equal sign in the environment variable name is malformed
  • having NULL bytes in both the name and value is malformed.

@github-actions
Copy link

There has not been any recent activity in this PR. It will automatically be closed in 7 days if no further action is taken.

@github-actions github-actions bot added the Stale label Mar 26, 2022
@github-actions github-actions bot closed this Apr 3, 2022
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.

4 participants