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 afe721e

Browse filesBrowse files
committed
Read environment variable from superglobals
The Dotenv component has recently been switched to using superglobals instead of putenv(). Let us support both and give priority to superglobals. Closes #31857
1 parent e8975e2 commit afe721e
Copy full SHA for afe721e

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+21
-3
lines changed

‎src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+21-3Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,32 @@ public function shutdown()
210210
});
211211
}
212212

213+
/**
214+
* @return mixed string|false
215+
*/
216+
private function getModeFromEnvironment()
217+
{
218+
if (false !== $this->mode) {
219+
return $this->mode;
220+
}
221+
222+
if (isset($_SERVER['SYMFONY_DEPRECATIONS_HELPER'])) {
223+
return $this->mode = $_SERVER['SYMFONY_DEPRECATIONS_HELPER'];
224+
}
225+
226+
if (isset($_ENV['SYMFONY_DEPRECATIONS_HELPER'])) {
227+
return $this->mode = $_ENV['SYMFONY_DEPRECATIONS_HELPER'];
228+
}
229+
230+
return $this->mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
231+
}
232+
213233
private function getConfiguration()
214234
{
215235
if (null !== $this->configuration) {
216236
return $this->configuration;
217237
}
218-
if (false === $mode = $this->mode) {
219-
$mode = getenv('SYMFONY_DEPRECATIONS_HELPER');
220-
}
238+
$mode = $this->getModeFromEnvironment();
221239
if ('strict' === $mode) {
222240
return $this->configuration = Configuration::inStrictMode();
223241
}

0 commit comments

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