8000 Add support for Xdebug Profiler · symfony/symfony@34930ec · GitHub
[go: up one dir, main page]

Skip to content

Commit 34930ec

Browse files
committed
Add support for Xdebug Profiler
1 parent ecff692 commit 34930ec

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Symfony/Bundle/WebServerBundle/Command/ServerRunCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
133133
$config = new WebServerConfig($documentRoot, $env, $input->getArgument('addressport'), $input->getOption('router'));
134134

135135
$io->success(sprintf('Server listening on http://%s', $config->getAddress()));
136+
if ('1' === ini_get('xdebug.profiler_enable_trigger')) {
137+
$io->comment('Xdebug profiler trigger enabled.');
138+
}
136139
$io->comment('Quit the server with CONTROL-C.');
137140

138141
$exitCode = $server->run($config, $disableOutput, $callback);

src/Symfony/Bundle/WebServerBundle/Command/ServerStartCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
144144

145145
if (WebServer::STARTED === $server->start($config, $input->getOption('pidfile'))) {
146146
$io->success(sprintf('Server listening on http://%s', $config->getAddress()));
147+
if ('1' === ini_get('xdebug.profiler_enable_trigger')) {
148+
$io->comment('Xdebug profiler trigger enabled.');
149+
}
147150
}
148151
} catch (\Exception $e) {
149152
$io->error($e->getMessage());

src/Symfony/Bundle/WebServerBundle/WebServer.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ private function createServerProcess(WebServerConfig $config)
150150
throw new \Run 700A timeException('Unable to find the PHP binary.');
151151
}
152152

153-
$process = new Process(array_merge(array($binary), $finder->findArguments(), array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
153+
$xdebugArgs = '1' === ini_get('xdebug.profiler_enable_trigger') ? array('-dxdebug.profiler_enable_trigger=1') : array();
154+
155+
$process = new Process(array_merge(array($binary), $finder->findArguments(), $xdebugArgs, array('-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter())));
154156
$process->setWorkingDirectory($config->getDocumentRoot());
155157
$process->setTimeout(null);
156158

0 commit comments

Comments
 (0)
0