Skip to content

Commit 5e777ad

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

File tree

16 files changed

+29
-15
lines changed

16 files changed

+29
-15
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.is_web_runtime_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.is_web_runtime_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.is_web_runtime_mode', 'bool')
246+
->factory('str_starts_with')
247+
->args(['%kernel.runtime_mode%', 'web']);
244248
;
245249
};

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' => \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg' ? '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' => \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg' ? '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' => \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg' ? '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' => \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg' ? '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' => \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg' ? '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' => \PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg' ? 'cli' : 'web',
190191
], __DIR__.\DIRECTORY_SEPARATOR.'Container%s');
191192

192193
)

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

200201
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy