Skip to content

Commit 9925c96

Browse files
Merge branch '6.4' into 7.0
* 6.4: Partially revert "DX: PHP CS Fixer - update excluded paths and apply some minor CS" [AssetMapper] Allowing for files to be written to some non-local location [HttpKernel] Resolve EBADP error on flock with LOCK_SH with NFS [AssetMapper] Fixing bug of bad parsing of imports when an import then export are adjacent add missing basque translations [FrameworkBundle][Validator] Allow implementing validation groups provider outside DTOs [Notifier][Novu] Implement overrides [Validator] Handle `null` case [Workflow] List place or transition listeners in profiler [Intl] Add support for emoji 15.1 Replace Tickets by Issues [Validator] Add missing arabic translations [Validator] Added missing translations for Romanian language for Validator component [Messenger] Fix graceful exit with ids [HttpKernel] Add parameters `kernel.runtime_mode` and `kernel.runtime_mode.*`, all set from env var `APP_RUNTIME_MODE`
2 parents 388a7f3 + 0be5396 commit 9925c96

10 files changed

+14
-3
lines changed

Dumper/PhpDumper.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class %s extends {$options['class']}
325325
326326
use Symfony\Component\DependencyInjection\Dumper\Preloader;
327327
328-
if (in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
328+
if (in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
329329
return;
330330
}
331331
@@ -373,6 +373,7 @@ class %s extends {$options['class']}
373373
'container.build_hash' => '$hash',
374374
'container.build_id' => '$id',
375375
'container.build_time' => $time,
376+
'container.runtime_mode' => \\in_array(\\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
376377
], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}');
377378
378379
EOF;
@@ -1576,7 +1577,7 @@ private function addDefaultParametersMethod(): string
15761577
$export = $this->exportParameters([$value], '', 12, $hasEnum);
15771578
$export = explode('0 => ', substr(rtrim($export, " ]\n"), 2, -1), 2);
15781579

1579-
if ($hasEnum || preg_match("/\\\$container->(?:getEnv\('(?:[-.\w\\\\]*+:)*+\w++'\)|targetDir\.'')/", $export[1])) {
1580+
if ($hasEnum || preg_match("/\\\$container->(?:getEnv\('(?:[-.\w\\\\]*+:)*+\w*+'\)|targetDir\.'')/", $export[1])) {
15801581
$dynamicPhp[$key] = sprintf('%s%s => %s,', $export[0], $this->export($key), $export[1]);
15811582
$this->dynamicParameters[$key] = true;
15821583
} else {

EnvVarProcessor.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
154154

155155
$returnNull = false;
156156
if ('' === $prefix) {
157+
if ('' === $name) {
158+
return null;
159+
}
157160
$returnNull = true;
158161
$prefix = 'string';
159162
}

ParameterBag/EnvPlaceholderParameterBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function get(string $name): array|bool|string|int|float|\UnitEnum|null
4141
return $placeholder; // return first result
4242
}
4343
}
44-
if (!preg_match('/^(?:[-.\w\\\\]*+:)*+\w++$/', $env)) {
44+
if (!preg_match('/^(?:[-.\w\\\\]*+:)*+\w*+$/', $env)) {
4545
throw new InvalidArgumentException(sprintf('Invalid %s name: only "word" characters are allowed.', $name));
4646
}
4747
if ($this->has($name) && null !== ($defaultValue = parent::get($name)) && !\is_string($defaultValue)) {

Tests/Fixtures/php/services10_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ return new \Container%s\ProjectServiceContainer([
154154
'container.build_hash' => '%s',
155155
'container.build_id' => '%s',
156156
'container.build_time' => %d,
157+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
157158
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
158159

159160
)

Tests/Fixtures/php/services9_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ return new \Container%s\ProjectServiceContainer([
787787
'container.build_hash' => '%s',
788788
'container.build_id' => '%s',
789789
'container.build_time' => %d,
790+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
790791
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
791792

792793
)

Tests/Fixtures/php/services9_inlined_factories.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ return new \Container%s\ProjectServiceContainer([
604604
'container.build_hash' => '%s',
605605
'container.build_id' => '%s',
606606
'container.build_time' => 1563381341,
607+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
607608
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
608609

609610
)

Tests/Fixtures/php/services9_inlined_factories_with_tagged_iterrator.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ return new \Container%s\ProjectServiceContainer([
119119
'container.build_hash' => '%s',
120120
'container.build_id' => '%s',
121121
'container.build_time' => %d,
122+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
122123
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
123124

124125
)

Tests/Fixtures/php/services9_lazy_inlined_factories.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ return new \Container%s\ProjectServiceContainer([
187187
'container.build_hash' => '%s',
188188
'container.build_id' => '%s',
189189
'container.build_time' => 1563381341,
190+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
190191
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
191192

192193
)

Tests/Fixtures/php/services_deprecated_parameters_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ return new \Container%s\ProjectServiceContainer([
195195
'container.build_hash' => '%s',
196196
'container.build_id' => '%s',
197197
'container.build_time' => %d,
198+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
198199
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
199200

200201
)

Tests/Fixtures/php/services_non_shared_lazy_as_files.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ return new \Container%s\Symfony_DI_PhpDumper_Service_Non_Shared_Lazy_As_File([
164164
'container.build_hash' => '%s',
165165
'container.build_id' => '%s',
166166
'container.build_time' => %d,
167+
'container.runtime_mode' => \in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'web=0' : 'web=1',
167168
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
168169

169170
)

0 commit comments

Comments
 (0)