Skip to content

Commit 4b6f4e7

Browse files
Merge branch '3.3' into 3.4
* 3.3: [Dotenv] Get env using $_SERVER to work with fastcgi_param and workaround thread safety issues [Dotenv][WebServerBundle] Override previously loaded variables [DI] Use GlobResource for non-tracked directories [WebProfilerBundle] Re add missing link to the controller
2 parents 5328825 + 1e9c1c7 commit 4b6f4e7

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Container.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,13 +452,13 @@ protected function getEnv($name)
452452
if (isset($this->envCache[$name]) || array_key_exists($name, $this->envCache)) {
453453
return $this->envCache[$name];
454454
}
455-
if (0 !== strpos($name, 'HTTP_') && isset($_SERVER[$name])) {
455+
if (isset($_SERVER[$name]) && 0 !== strpos($name, 'HTTP_')) {
456456
return $this->envCache[$name] = $_SERVER[$name];
457457
}
458458
if (isset($_ENV[$name])) {
459459
return $this->envCache[$name] = $_ENV[$name];
460460
}
461-
if (false !== $env = getenv($name)) {
461+
if (false !== ($env = getenv($name)) && null !== $env) { // null is a possible value because of thread safety issues
462462
return $this->envCache[$name] = $env;
463463
}
464464
if (!$this->hasParameter("env($name)")) {

ContainerBuilder.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,13 @@ public function fileExists($path, $trackContents = true)
408408
return $exists;
409409
}
410410

411-
if ($trackContents && is_dir($path)) {
412-
$this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null));
413-
} elseif ($trackContents || is_dir($path)) {
411+
if (is_dir($path)) {
412+
if ($trackContents) {
413+
$this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null));
414+
} else {
415+
$this->addResource(new GlobResource($path, '/*', false));
416+
}
417+
} elseif ($trackContents) {
414418
$this->addResource(new FileResource($path));
415419
}
416420

0 commit comments

Comments
 (0)