From d414213740eddfe55e84aea3b91f72402d9b4806 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 13 Sep 2013 12:38:25 +0100 Subject: [PATCH 01/13] [DomCrawler] Added missing docblocks and removed unneeded return annotation. --- src/Symfony/Component/DomCrawler/Crawler.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index f39c5d333dbad..c5fc198a349dc 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -84,8 +84,6 @@ public function add($node) * * @param string $content A string to parse as HTML/XML * @param null|string $type The content type of the string - * - * @return null|void */ public function addContent($content, $type = null) { @@ -710,6 +708,11 @@ public static function xpathLiteral($s) return sprintf("concat(%s)", implode($parts, ', ')); } + /** + * @param integer $position + * + * @return \DOMElement|null + */ private function getNode($position) { foreach ($this as $i => $node) { @@ -723,6 +726,12 @@ private function getNode($position) // @codeCoverageIgnoreEnd } + /** + * @param \DOMElement $node + * @param string $siblingDir + * + * @return array + */ private function sibling($node, $siblingDir = 'nextSibling') { $nodes = array(); From d6f4def1a3a472a87d3fcc3227f2055f1329c894 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 13 Sep 2013 13:15:01 +0100 Subject: [PATCH 02/13] [Translation] Removed an unneeded return annotation. --- src/Symfony/Component/Translation/PluralizationRules.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Symfony/Component/Translation/PluralizationRules.php b/src/Symfony/Component/Translation/PluralizationRules.php index 5c63b8d0cbe9d..fe29ba599a433 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -193,8 +193,6 @@ public static function get($number, $locale) * @param string $rule A PHP callable * @param string $locale The locale * - * @return null - * * @throws \LogicException */ public static function set($rule, $locale) From c27cd0959f3bd129adb5532d15f0cb2462201488 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 13 Sep 2013 17:27:28 +0200 Subject: [PATCH 03/13] added missing method in the UPGRADE file for 2.2 (closes #8941) --- UPGRADE-2.2.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/UPGRADE-2.2.md b/UPGRADE-2.2.md index 524a8f7e1d999..3af628ffd8f74 100644 --- a/UPGRADE-2.2.md +++ b/UPGRADE-2.2.md @@ -459,8 +459,9 @@ } ``` - * The method `ExecutionContext::addViolationAtSubPath()` was deprecated and - will be removed in Symfony 2.3. You should use `addViolationAt()` instead. + * The methods `ExecutionContext::addViolationAtSubPath()` and + `ExecutionContext::addViolationAtPath()` were deprecated and will be + removed in Symfony 2.3. You should use `addViolationAt()` instead. Before: From b1242ef1433fb36dd35c5ed8db540c51db0fbde6 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 15 Sep 2013 10:08:06 +0200 Subject: [PATCH 04/13] LICENSE files moved to meta folders --- src/Symfony/Bundle/FrameworkBundle/{ => Resources/meta}/LICENSE | 0 src/Symfony/Bundle/SecurityBundle/{ => Resources/meta}/LICENSE | 0 src/Symfony/Bundle/TwigBundle/{ => Resources/meta}/LICENSE | 0 src/Symfony/Bundle/WebProfilerBundle/{ => Resources/meta}/LICENSE | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/Symfony/Bundle/FrameworkBundle/{ => Resources/meta}/LICENSE (100%) rename src/Symfony/Bundle/SecurityBundle/{ => Resources/meta}/LICENSE (100%) rename src/Symfony/Bundle/TwigBundle/{ => Resources/meta}/LICENSE (100%) rename src/Symfony/Bundle/WebProfilerBundle/{ => Resources/meta}/LICENSE (100%) diff --git a/src/Symfony/Bundle/FrameworkBundle/LICENSE b/src/Symfony/Bundle/FrameworkBundle/Resources/meta/LICENSE similarity index 100% rename from src/Symfony/Bundle/FrameworkBundle/LICENSE rename to src/Symfony/Bundle/FrameworkBundle/Resources/meta/LICENSE diff --git a/src/Symfony/Bundle/SecurityBundle/LICENSE b/src/Symfony/Bundle/SecurityBundle/Resources/meta/LICENSE similarity index 100% rename from src/Symfony/Bundle/SecurityBundle/LICENSE rename to src/Symfony/Bundle/SecurityBundle/Resources/meta/LICENSE diff --git a/src/Symfony/Bundle/TwigBundle/LICENSE b/src/Symfony/Bundle/TwigBundle/Resources/meta/LICENSE similarity index 100% rename from src/Symfony/Bundle/TwigBundle/LICENSE rename to src/Symfony/Bundle/TwigBundle/Resources/meta/LICENSE diff --git a/src/Symfony/Bundle/WebProfilerBundle/LICENSE b/src/Symfony/Bundle/WebProfilerBundle/Resources/meta/LICENSE similarity index 100% rename from src/Symfony/Bundle/WebProfilerBundle/LICENSE rename to src/Symfony/Bundle/WebProfilerBundle/Resources/meta/LICENSE From 48582402c0fc50c1f47a883d5b9939368d827ee9 Mon Sep 17 00:00:00 2001 From: fturmel Date: Sat, 14 Sep 2013 14:15:18 -0400 Subject: [PATCH 05/13] HttpFoundation Request test for #8619 --- .../HttpFoundation/Tests/RequestTest.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index f9868a905a55b..bb810a81dc16a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -726,6 +726,28 @@ public function testGetPort() $port = $request->getPort(); $this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to http return 80.'); + + //On + $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + 'HTTP_X_FORWARDED_PROTO' => 'On' + )); + $port = $request->getPort(); + $this->assertEquals(443, $port, 'With only PROTO set and value is On, getPort() defaults to 443.'); + + //1 + $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + 'HTTP_X_FORWARDED_PROTO' => '1' + )); + $port = $request->getPort(); + $this->assertEquals(443, $port, 'With only PROTO set and value is 1, getPort() defaults to 443.'); + + //something-else + $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( + 'HTTP_X_FORWARDED_PROTO' => 'something-else' + )); + $port = $request->getPort(); + $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.'); + Request::setTrustedProxies(array()); } From 32fc4d8758329d3f4356595770821cc4ece8a62b Mon Sep 17 00:00:00 2001 From: fturmel Date: Sun, 15 Sep 2013 09:52:15 -0400 Subject: [PATCH 06/13] HttpFoundation RequestTest - Fixed indentation and removed comments --- .../HttpFoundation/Tests/RequestTest.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index bb810a81dc16a..0741b9db6cbc1 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -727,24 +727,21 @@ public function testGetPort() $this->assertEquals(80, $port, 'If X_FORWARDED_PROTO is set to http return 80.'); - //On $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'On' - )); + 'HTTP_X_FORWARDED_PROTO' => 'On' + )); $port = $request->getPort(); $this->assertEquals(443, $port, 'With only PROTO set and value is On, getPort() defaults to 443.'); - //1 $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => '1' - )); + 'HTTP_X_FORWARDED_PROTO' => '1' + )); $port = $request->getPort(); $this->assertEquals(443, $port, 'With only PROTO set and value is 1, getPort() defaults to 443.'); - //something-else $request = Request::create('http://example.com', 'GET', array(), array(), array(), array( - 'HTTP_X_FORWARDED_PROTO' => 'something-else' - )); + 'HTTP_X_FORWARDED_PROTO' => 'something-else' + )); $port = $request->getPort(); $this->assertEquals(80, $port, 'With only PROTO set and value is not recognized, getPort() defaults to 80.'); From 568113f64aa6e89fd5fa506261512d128b32e10b Mon Sep 17 00:00:00 2001 From: Cas Date: Sat, 14 Sep 2013 16:21:59 +0200 Subject: [PATCH 07/13] Typo fix Small typo/grammar fix in class' comment --- .../Component/DependencyInjection/Loader/PhpFileLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php index f2bf441d25fb2..e866a29f7067a 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php @@ -17,7 +17,7 @@ * PhpFileLoader loads service definitions from a PHP file. * * The PHP file is required and the $container variable can be - * used form the file to change the container. + * used within the file to change the container. * * @author Fabien Potencier */ From 0e437c59787202f1338278ca7f6161c1ab3276fb Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Mon, 16 Sep 2013 18:44:24 +0200 Subject: [PATCH 08/13] [BrowserKit] Fixed the handling of parameters when redirecting POST parameters should not be transmitted as GET parameters after the redirection when changing the method. --- src/Symfony/Component/BrowserKit/Client.php | 9 ++++++++- src/Symfony/Component/BrowserKit/Tests/ClientTest.php | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 2c5dd26d5f827..0b0f1e14f5a9b 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -435,10 +435,17 @@ public function followRedirect() $content = $request->getContent(); } + if ('get' === strtolower($method)) { + // Don't forward parameters for GET request as it should reach the redirection URI + $parameters = array(); + } else { + $parameters = $request->getParameters(); + } + $server = $request->getServer(); unset($server['HTTP_IF_NONE_MATCH'], $server['HTTP_IF_MODIFIED_SINCE']); - return $this->request($method, $this->redirect, $request->getParameters(), $files, $server, $content); + return $this->request($method, $this->redirect, $parameters, $files, $server, $content); } /** diff --git a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php index 7c9d18d81ad52..2ed0dcdcf494a 100644 --- a/src/Symfony/Component/BrowserKit/Tests/ClientTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/ClientTest.php @@ -329,9 +329,10 @@ public function testFollowRedirect() $client = new TestClient(); $client->setNextResponse(new Response('', 302, array('Location' => 'http://www.example.com/redirected'))); - $client->request('POST', 'http://www.example.com/foo/foobar'); + $client->request('POST', 'http://www.example.com/foo/foobar', array('name' => 'bar')); $this->assertEquals('get', $client->getRequest()->getMethod(), '->followRedirect() uses a get for 302'); + $this->assertEquals(array(), $client->getRequest()->getParameters(), '->followRedirect() does not submit parameters when changing the method'); } public function testFollowRedirectWithCookies() From c6c35b3db983fe8c3e76a71577511787258f5dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Sun, 25 Aug 2013 15:33:45 +0200 Subject: [PATCH 09/13] [Console] Escape exception message during the rendering of an exception --- src/Symfony/Component/Console/Application.php | 3 ++- .../Console/Tests/ApplicationTest.php | 3 +++ .../Console/Tests/Fixtures/Foo3Command.php | 8 ++++-- .../Fixtures/application_renderexception3.txt | 24 +++++++++++------ .../application_renderexception3decorated.txt | 27 +++++++++++++++++++ 5 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 1381d5f394423..b64f4bb268c67 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -23,6 +23,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\HelpCommand; use Symfony\Component\Console\Command\ListCommand; +use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Helper\DialogHelper; @@ -827,7 +828,7 @@ public function renderException($e, $output) $output->writeln(""); $output->writeln(""); foreach ($messages as $message) { - $output->writeln(''.$message.''); + $output->writeln(''.OutputFormatter::escape($message).''); } $output->writeln(""); $output->writeln(""); diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index f78d8de107ab4..7f73aa1a4df16 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -429,6 +429,9 @@ public function testRenderException() $tester->run(array('command' => 'foo3:bar'), array('decorated' => false)); $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() renders a pretty exceptions with previous exceptions'); + $tester->run(array('command' => 'foo3:bar'), array('decorated' => true)); + $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3decorated.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions'); + $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth')); $application->setAutoExit(false); $application->expects($this->any()) diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php index 7349bc355e7e1..2a59b1d297a97 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php @@ -17,9 +17,13 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { try { - throw new \Exception("First exception"); + try { + throw new \Exception("First exception

this is html

"); + } catch (\Exception $e) { + throw new \Exception("Second exception comment", 0, $e); + } } catch (\Exception $e) { - throw new \Exception("Second exception", 0, $e); + throw new \Exception("Third exception comment", 0, $e); } } } diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt index c639924238174..a12a32c577115 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt @@ -1,17 +1,25 @@ - - [Exception] - Second exception - + + [Exception] + Third exception comment + - - [Exception] - First exception - + + [Exception] + Second exception comment + + + + + + + [Exception] + First exception

this is html

+ foo3:bar diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt new file mode 100644 index 0000000000000..9f9d0cbc048ff --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt @@ -0,0 +1,27 @@ + + +  + [Exception]  + Third exception comment  +  + + + + +  + [Exception]  + Second exception comment  +  + + + + +  + [Exception]  + First exception

this is html

 +  + + +foo3:bar + + From a47d663f251ac68852a5c6d0ba86ff3f8a38428a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Sep 2013 14:13:58 +0200 Subject: [PATCH 10/13] [Console] fixed the formatter for single-char tags --- .../Component/Console/Formatter/OutputFormatter.php | 2 +- .../Console/Tests/Formatter/OutputFormatterTest.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index f3c3298866533..01904ccb48649 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -23,7 +23,7 @@ class OutputFormatter implements OutputFormatterInterface /** * The pattern to phrase the format. */ - const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?: [^<\\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<=\\\\<) )*)#isx'; + const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]*)?>((?: [^<\\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<=\\\\<) )*)#isx'; private $decorated; private $styles = array(); diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index 497630e87c5da..08bd02e852cd4 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -113,7 +113,10 @@ public function testNewStyle() $this->assertEquals($style, $formatter->getStyle('test')); $this->assertNotEquals($style, $formatter->getStyle('info')); - $this->assertEquals("\033[34;47msome custom msg\033[0m", $formatter->format('some custom msg')); + $style = new OutputFormatterStyle('blue', 'white'); + $formatter->setStyle('b', $style); + + $this->assertEquals("\033[34;47msome \033[0m\033[34;47mcustom\033[0m\033[34;47m msg\033[0m", $formatter->format('some custom msg')); } public function testRedefineStyle() @@ -137,7 +140,7 @@ public function testInlineStyle() public function testNonStyleTag() { $formatter = new OutputFormatter(true); - $this->assertEquals("\033[32msome \033[0m\033[32m styled\033[0m", $formatter->format('some styled')); + $this->assertEquals("\033[32msome \033[0m\033[32m styled \033[0m\033[32m

single-char tag\033[0m\033[32m

\033[0m", $formatter->format('some styled

single-char tag

')); } public function testNotDecoratedFormatter() From 1f88a28d54e006bd4090bfb3bb7a31bef4e57cf3 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Sep 2013 14:15:59 +0200 Subject: [PATCH 11/13] [Console] added some more information about OutputFormatter::replaceStyle() --- src/Symfony/Component/Console/Formatter/OutputFormatter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 01904ccb48649..36721601ed3bc 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -163,6 +163,8 @@ public function getStyleStack() /** * Replaces style of the output. * + * All escaped tags and tags that reference unknown styles are kept as is. + * * @param array $match * * @return string The replaced style From c8d0342887620f3067506c6cd388ee9844b2efbf Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 17 Sep 2013 14:23:45 +0200 Subject: [PATCH 12/13] [Console] fixed exception rendering when nested styles --- src/Symfony/Component/Console/Application.php | 29 +++++++++---------- .../Console/Tests/Fixtures/Foo3Command.php | 2 +- .../Fixtures/application_renderexception3.txt | 16 +++++----- .../application_renderexception3decorated.txt | 18 ++++++------ 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index b64f4bb268c67..49ef6224f7a45 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -23,7 +23,6 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\HelpCommand; use Symfony\Component\Console\Command\ListCommand; -use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\FormatterHelper; use Symfony\Component\Console\Helper\DialogHelper; @@ -809,29 +808,29 @@ public function renderException($e, $output) $title = sprintf(' [%s] ', get_class($e)); $len = $strlen($title); $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX; + $formatter = $output->getFormatter(); $lines = array(); foreach (preg_split('/\r?\n/', $e->getMessage()) as $line) { foreach (str_split($line, $width - 4) as $line) { - $lines[] = sprintf(' %s ', $line); - $len = max($strlen($line) + 4, $len); + // pre-format lines to get the right string length + $lineLength = $strlen(preg_replace('/\[[^m]*m/', '', $formatter->format($line))) + 4; + $lines[] = array($line, $lineLength); + + $len = max($lineLength, $len); } } - $messages = array(str_repeat(' ', $len), $title.str_repeat(' ', max(0, $len - $strlen($title)))); - + $messages = array('', ''); + $messages[] = $emptyLine = $formatter->format(sprintf('%s', str_repeat(' ', $len))); + $messages[] = $formatter->format(sprintf('%s%s', $title, str_repeat(' ', max(0, $len - $strlen($title))))); foreach ($lines as $line) { - $messages[] = $line.str_repeat(' ', $len - $strlen($line)); + $messages[] = $formatter->format(sprintf(' %s %s', $line[0], str_repeat(' ', $len - $line[1]))); } + $messages[] = $emptyLine; + $messages[] = ''; + $messages[] = ''; - $messages[] = str_repeat(' ', $len); - - $output->writeln(""); - $output->writeln(""); - foreach ($messages as $message) { - $output->writeln(''.OutputFormatter::escape($message).''); - } - $output->writeln(""); - $output->writeln(""); + $output->writeln($messages, OutputInterface::OUTPUT_RAW); if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) { $output->writeln('Exception trace:'); diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php index 2a59b1d297a97..43a35076e36ba 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php +++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo3Command.php @@ -20,7 +20,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { throw new \Exception("First exception

this is html

"); } catch (\Exception $e) { - throw new \Exception("Second exception comment", 0, $e); + throw new \Exception("Second exception comment", 0, $e); } } catch (\Exception $e) { throw new \Exception("Third exception comment", 0, $e); diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt index a12a32c577115..72a72867f3fd7 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3.txt @@ -1,17 +1,17 @@ - - [Exception] - Third exception comment - + + [Exception] + Third exception comment + - - [Exception] - Second exception comment - + + [Exception] + Second exception comment + diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt index 9f9d0cbc048ff..eb4181c2b4a91 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_renderexception3decorated.txt @@ -1,24 +1,24 @@ -  - [Exception]  - Third exception comment  -  +  + [Exception]  + Third exception comment  +  -  - [Exception]  - Second exception comment  -  +  + [Exception]  + Second exception comment  +     [Exception]  - First exception

this is html

 + First exception 

this is html

   From 0e80d8801531f37c5f15fa00f0986aa9a231acc9 Mon Sep 17 00:00:00 2001 From: Fabrice Bernhard Date: Tue, 17 Sep 2013 18:48:45 +0200 Subject: [PATCH 13/13] fixes RequestDataCollector bug, visible when used on Drupal8 In Drupal8 ```$request->attributes->all()``` returns an array with a 0 key whose value is the ```Drupal\user\Entity\User``` ```php array( 0 => Drupal\user\Entity\User, ... ) ``` ```('_route' == $key && is_object($value))``` is therefore true which provokes an exception: ```php FatalErrorException: Error: Call to undefined method Drupal\user\Entity\User::getPath() in [...]/RequestDataCollector.php line 54 ``` This patch corrects this with a simple replacement of == by === --- .../HttpKernel/DataCollector/RequestDataCollector.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 28b0072433b1d..d7da25e0600bb 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -50,9 +50,9 @@ public function collect(Request $request, Response $response, \Exception $except $attributes = array(); foreach ($request->attributes->all() as $key => $value) { - if ('_route' == $key && is_object($value)) { + if ('_route' === $key && is_object($value)) { $attributes['_route'] = $this->varToString($value->getPath()); - } elseif ('_route_params' == $key) { + } elseif ('_route_params' === $key) { foreach ($value as $key => $v) { $attributes['_route_params'][$key] = $this->varToString($v); }