Merge branch '3.2'

* 3.2:
  [Console] Fix test
  [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:51:00 +02:00
commit d5af0da0a7
3 changed files with 19 additions and 18 deletions

View File

@ -12,6 +12,7 @@
namespace Symfony\Component\Console;
use Symfony\Component\Console\Exception\ExceptionInterface;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\DebugFormatterHelper;
use Symfony\Component\Console\Helper\ProcessHelper;
use Symfony\Component\Console\Helper\QuestionHelper;
@ -673,7 +674,7 @@ class Application
}
$formatter = $output->getFormatter();
$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) {
// pre-format lines to get the right string length
$lineLength = $this->stringWidth(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4;

View File

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

View File

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