diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 0327a46f71701..792cab54403ec 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -250,20 +250,33 @@ public function __destruct() private function doDump($data, $name, $file, $line) { - if ($this->dumper instanceof HtmlDumper) { - $name = $this->htmlEncode($name); - $file = $this->htmlEncode($file); - if ('' !== $file) { - if ($this->fileLinkFormat) { - $link = strtr($this->fileLinkFormat, array('%f' => $file, '%l' => $line)); - $name = sprintf('%s', $link, $file, $name); + if (PHP_VERSION_ID >= 50400 && $this->dumper instanceof CliDumper) { + $contextDumper = function ($name, $file, $line, $fileLinkFormat) { + if ($this instanceof HtmlDumper) { + if ('' !== $file) { + $s = $this->style('meta', '%s'); + $name = strip_tags($this->style('', $name)); + $file = strip_tags($this->style('', $file)); + if ($fileLinkFormat) { + $link = strtr($fileLinkFormat, array('%f' => $file, '%l' => (int) $line)); + $name = sprintf(''.$s.'', $link, $file, $name); + } else { + $name = sprintf(''.$s.'', $file, $name); + } + } else { + $name = $this->style('meta', $name); + } + $this->line = $name.' on line '.$this->style('meta', $line).':'; } else { - $name = sprintf('%s', $file, $name); + $this->line = $this->style('meta', $name).' on line '.$this->style('meta', $line).':'; } - } - echo "\n{$name} on line {$line}:"; + $this->dumpLine(0); + }; + $contextDumper = $contextDumper->bindTo($this->dumper, $this->dumper); + $contextDumper($name, $file, $line, $this->fileLinkFormat); } else { - echo "{$name} on line {$line}:\n"; + $cloner = new VarCloner(); + $this->dumper->dump($cloner->cloneVar($name.' on line '.$line.':')); } $this->dumper->dump($data); } diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php index 7d19cb01b1d8c..7381d1d089e55 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -71,7 +71,11 @@ public function testCollectDefault() $collector->collect(new Request(), new Response()); $output = ob_get_clean(); - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output); + if (PHP_VERSION_ID >= 50400) { + $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output); + } else { + $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n123\n", $output); + } } public function testCollectHtml() @@ -84,8 +88,8 @@ public function testCollectHtml() $line = __LINE__ - 1; $file = __FILE__; $xOutput = <<DumpDataCollectorTest.php on line {$line}:
123
+ 
DumpDataCollectorTest.php on line {$line}:
+123
 
EOTXT; @@ -110,6 +114,10 @@ public function testFlush() ob_start(); $collector = null; - $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean()); + if (PHP_VERSION_ID >= 50400) { + $this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean()); + } else { + $this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean()); + } } } 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