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

[HttpKernel] Preventing error 500 when function putenv is disabled #52428

Merged
merged 1 commit into from Nov 2, 2023

Conversation

ShaiMagal
Copy link
Contributor

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

Description:
Some webhostings are blocking function "putenv". So, it will show error 500 Error (UndefinedFunction) with text:
Attempted to call function "putenv" from namespace "Symfony\Component\HttpKernel

This PR is checking callability of putenv first, so preventing error 500.

How to test?
-> php.ini - disabled_functions=putenv
-> enable debug

  • Then you will see error 500
    -> After this PR/commit, it's without problem.

For example it's very common problem for PrestaShop users. (PrestaShop is using Symfony)

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

src/Symfony/Component/HttpKernel/Kernel.php Outdated Show resolved Hide resolved
@ShaiMagal
Copy link
Contributor Author

@stof Updated :)

@carsonbot carsonbot changed the title Preventing error 500 when function putenv is disabled [HttpKernel] Preventing error 500 when function putenv is disabled Nov 2, 2023
@ShaiMagal
Copy link
Contributor Author

ShaiMagal commented Nov 2, 2023

Guys, will this be merged with branch 6.x as well in future or I should make another PR specially for 6.x? (this PR I targeted to 5.4 but I don't know if this will be at 6.x in future... so I am asking, how to do this correctly.

Thank you.

@stof
Copy link
Member

stof commented Nov 2, 2023

@ShaiMagal this will be merged up by the core team once this PR is merged (the merge up happens usually once a week for dev version, and it will happen for sure before tagging a release)

@fabpot
Copy link
Member

fabpot commented Nov 2, 2023

Should we do the same in src/Symfony/Component/BrowserKit/AbstractBrowser.php and src/Symfony/Component/Runtime/SymfonyRuntime.php?

@nicolas-grekas
Copy link
Member

I had a look and I don't think we need to: AbstractBrowser + the spot in Runtime are for command line usages, and to me those are not affected by (cheap) hosters.

@fabpot
Copy link
Member

fabpot commented Nov 2, 2023

Thank you @ShaiMagal.

@fabpot fabpot merged commit b421063 into symfony:5.4 Nov 2, 2023
7 of 10 checks passed
@ShaiMagal ShaiMagal deleted the 5.4 branch November 2, 2023 20:49
This was referenced Nov 10, 2023
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

8 participants