Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6ed9919

Browse files
committed
fixed $_ENV/$_SERVER precedence in test framework
1 parente6d949b commit6ed9919

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private static function getPhpUnitCliConfigArgument()
107107
protectedstaticfunctiongetKernelClass()
108108
{
109109
if (isset($_SERVER['KERNEL_CLASS']) ||isset($_ENV['KERNEL_CLASS'])) {
110-
$class =isset($_SERVER['KERNEL_CLASS']) ?$_SERVER['KERNEL_CLASS'] :$_ENV['KERNEL_CLASS'];
110+
$class =isset($_ENV['KERNEL_CLASS']) ?$_ENV['KERNEL_CLASS'] :$_SERVER['KERNEL_CLASS'];
111111
if (!class_exists($class)) {
112112
thrownew \RuntimeException(sprintf('Class "%s" doesn\'t exist or cannot be autoloaded. Check that the KERNEL_CLASS value in phpunit.xml matches the fully-qualified class name of your Kernel or override the %s::createKernel() method.',$class,static::class));
113113
}
@@ -116,7 +116,7 @@ protected static function getKernelClass()
116116
}
117117

118118
if (isset($_SERVER['KERNEL_DIR']) ||isset($_ENV['KERNEL_DIR'])) {
119-
$dir =isset($_SERVER['KERNEL_DIR']) ?$_SERVER['KERNEL_DIR'] :$_ENV['KERNEL_DIR'];
119+
$dir =isset($_ENV['KERNEL_DIR']) ?$_ENV['KERNEL_DIR'] :$_SERVER['KERNEL_DIR'];
120120

121121
if (!is_dir($dir)) {
122122
$phpUnitDir =static::getPhpUnitXmlDir();
@@ -176,20 +176,20 @@ protected static function createKernel(array $options = array())
176176

177177
if (isset($options['environment'])) {
178178
$env =$options['environment'];
179-
}elseif (isset($_SERVER['APP_ENV'])) {
180-
$env =$_SERVER['APP_ENV'];
181179
}elseif (isset($_ENV['APP_ENV'])) {
182180
$env =$_ENV['APP_ENV'];
181+
}elseif (isset($_SERVER['APP_ENV'])) {
182+
$env =$_SERVER['APP_ENV'];
183183
}else {
184184
$env ='test';
185185
}
186186

187187
if (isset($options['debug'])) {
188188
$debug =$options['debug'];
189-
}elseif (isset($_SERVER['APP_DEBUG'])) {
190-
$debug =$_SERVER['APP_DEBUG'];
191189
}elseif (isset($_ENV['APP_DEBUG'])) {
192190
$debug =$_ENV['APP_DEBUG'];
191+
}elseif (isset($_SERVER['APP_DEBUG'])) {
192+
$debug =$_SERVER['APP_DEBUG'];
193193
}else {
194194
$debug =true;
195195
}

‎src/Symfony/Component/DependencyInjection/Container.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,12 @@ protected function getEnv($name)
432432
if (isset($this->envCache[$name]) ||array_key_exists($name,$this->envCache)) {
433433
return$this->envCache[$name];
434434
}
435-
if (isset($_SERVER[$name]) &&0 !==strpos($name,'HTTP_')) {
436-
return$this->envCache[$name] =$_SERVER[$name];
437-
}
438435
if (isset($_ENV[$name])) {
439436
return$this->envCache[$name] =$_ENV[$name];
440437
}
438+
if (isset($_SERVER[$name]) &&0 !==strpos($name,'HTTP_')) {
439+
return$this->envCache[$name] =$_SERVER[$name];
440+
}
441441
if (false !== ($env =getenv($name)) &&null !==$env) {// null is a possible value because of thread safety issues
442442
return$this->envCache[$name] =$env;
443443
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp