Merge branch '2.8' into 3.2

* 2.8:
  [HttpKernel] Fix test
  Remove port from default host in server:status command
  [Console] Escape exception messages
This commit is contained in:
Nicolas Grekas 2017-03-27 16:49:31 +02:00
commit 56d476942c
4 changed files with 20 additions and 19 deletions

View File

@ -32,7 +32,7 @@ class ServerStatusCommand extends ServerCommand
{ {
$this $this
->setDefinition(array( ->setDefinition(array(
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'), new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1'),
new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'), new InputOption('port', 'p', InputOption::VALUE_REQUIRED, 'Address port number', '8000'),
)) ))
->setName('server:status') ->setName('server:status')

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Console; namespace Symfony\Component\Console;
use Symfony\Component\Console\Exception\ExceptionInterface; use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\DebugFormatterHelper; use Symfony\Component\Console\Helper\DebugFormatterHelper;
use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Helper\QuestionHelper;
@ -636,7 +637,7 @@ class Application
} }
$formatter = $output->getFormatter(); $formatter = $output->getFormatter();
$lines = array(); $lines = array();
foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) { foreach (preg_split('/\r?\n/', OutputFormatter::escape($e->getMessage())) as $line) {
foreach ($this->splitStringByWidth($line, $width - 4) as $line) { foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
// pre-format lines to get the right string length // pre-format lines to get the right string length
$lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4; $lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4;

View File

@ -1,13 +1,13 @@
[Exception] [Exception]
Third exception comment Third exception <fg=blue;bg=red>comment</>
[Exception] [Exception]
Second exception comment Second exception <comment>comment</comment>
[Exception] [Exception]

View File

@ -1,17 +1,17 @@
   
 [Exception]   [Exception] 
 Third exception comment   Third exception <fg=blue;bg=red>comment</> 
   
   
 [Exception]   [Exception] 
 Second exception comment   Second exception <comment>comment</comment> 
   
   
 [Exception]   [Exception] 
 First exception <p>this is html</p>   First exception <p>this is html</p> 
   
foo3:bar foo3:bar