Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b421063

Browse filesBrowse files
committed
bug #52428 [HttpKernel] Preventing error 500 when function putenv is disabled (ShaiMagal)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [HttpKernel] Preventing error 500 when function putenv is disabled | 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) Commits ------- e4be02a [HttpKernel] Preventing error 500 when function putenv is disabled
2 parents 6765a43 + e4be02a commit b421063
Copy full SHA for b421063

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

‎src/Symfony/Component/HttpKernel/Kernel.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Kernel.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,9 @@ private function preBoot(): ContainerInterface
778778
$this->startTime = microtime(true);
779779
}
780780
if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) {
781-
putenv('SHELL_VERBOSITY=3');
781+
if (\function_exists('putenv')) {
782+
putenv('SHELL_VERBOSITY=3');
783+
}
782784
$_ENV['SHELL_VERBOSITY'] = 3;
783785
$_SERVER['SHELL_VERBOSITY'] = 3;
784786
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.