Skip to content

Commit 54ed084

Browse files
[HttpKernel] Add parameter kernel.runtime_mode, defined as %env(default:container.runtime_mode:APP_RUNTIME_MODE)%
1 parent f13a4b1 commit 54ed084

File tree

23 files changed

+37
-23
lines changed

23 files changed

+37
-23
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
11711171
$container->setDefinition('debug.log_processor', $definition);
11721172

11731173
$container->register('debug.debug_logger_configurator', DebugLoggerConfigurator::class)
1174-
->setArguments([new Reference('debug.log_processor')]);
1174+
->setArguments([new Reference('debug.log_processor'), new Reference('kernel.web_mode')]);
11751175
}
11761176
}
11771177

src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
->tag('monolog.logger', ['channel' => 'php'])
3333

3434
->set('debug.debug_handlers_listener', DebugHandlersListener::class)
35+
->args([null, service('kernel.web_mode')])
3536
->tag('kernel.event_subscriber')
3637

3738
->set('debug.file_link_formatter', FileLinkFormatter::class)

src/Symfony/Bundle/FrameworkBundle/Resources/config/services.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,5 +241,9 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
241241
->set(Request::class)->abstract()->tag('container.excluded')
242242
->set(Response::class)->abstract()->tag('container.excluded')
243243
->set(SessionInterface::class)->abstract()->tag('container.excluded')
244+
245+
->set('kernel.web_mode', 'bool')
246+
->factory('str_starts_with')
247+
->args(['%kernel.runtime_mode%', 'web'])
244248
;
245249
};

src/Symfony/Component/Cache/Traits/ContractsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function setCallbackWrapper(?callable $callbackWrapper): callable
4444
if (!isset($this->callbackWrapper)) {
4545
$this->callbackWrapper = LockRegistry::compute(...);
4646

47-
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
47+
if (\in_array(\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
4848
$this->setCallbackWrapper(null);
4949
}
5050
}

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ class %s extends {$options['class']}
388388
'container.build_hash' => '$hash',
389389
'container.build_id' => '$id',
390390
'container.build_time' => $time,
391+
'container.runtime_mode' => \\in_array(\\PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) ? 'cli' : 'web',
391392
], __DIR__.\\DIRECTORY_SEPARATOR.'Container{$hash}');
392393
393394
EOF;

src/Symfony/Component/DependencyInjection/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) ? 'cli' : 'web',
157158
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
158159

159160
)

src/Symfony/Component/DependencyInjection/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) ? 'cli' : 'web',
790791
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
791792

792793
)

src/Symfony/Component/DependencyInjection/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) ? 'cli' : 'web',
607608
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
608609

609610
)

src/Symfony/Component/DependencyInjection/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) ? 'cli' : 'web',
122123
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
123124

124125
)

src/Symfony/Component/DependencyInjection/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) ? 'cli' : 'web',
190191
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
191192

192193
)

0 commit comments

Comments
 (0)