Skip to content

Commit d4342cb

Browse files
committed
table header labels should be dumped / escaped
1 parent d3aadfb commit d4342cb

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/Debug/Dump/Html/Table.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ protected function buildFooter()
199199
protected function buildHeader()
200200
{
201201
$labels = \array_map(function (array $colInfo) {
202-
$label = $colInfo['key'];
202+
$label = $this->dumper->valDumper->dump($colInfo['key'], array(
203+
'tagName' => null,
204+
));
203205
if (!empty($colInfo['class'])) {
204206
$label .= ' ' . $this->dumper->valDumper->markupIdentifier($colInfo['class'], 'className');
205207
}

tests/Debug/Plugin/Method/TableTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ public static function providerTestMethod()
9595
// not all date2 values of same type
9696
$rowsB = array(
9797
array(
98-
'date' => new \DateTime('1955-11-05'),
98+
'dɑte' => new \DateTime('1955-11-05'),
9999
'date2' => 'not a datetime',
100100
),
101101
array(
102-
'date' => new \DateTime('1985-10-26'),
102+
'dɑte' => new \DateTime('1985-10-26'),
103103
'date2' => new \DateTime('2015-10-21'),
104104
),
105105
);
@@ -680,6 +680,7 @@ public static function providerTestMethod()
680680
)),
681681
Debug::meta('tableInfo', array(
682682
'rows' => array(
683+
// @deprecate this ability to override row keys
683684
'b' => array('key' => 'Bob'),
684685
's' => array('key' => 'Sally'),
685686
),
@@ -712,7 +713,7 @@ public static function providerTestMethod()
712713
<table class="sortable table-bordered">
713714
<caption>not all col values of same type</caption>
714715
<thead>
715-
<tr><th>&nbsp;</th><th scope="col">date <span class="classname">DateTime</span></th><th scope="col">date2</th></tr>
716+
<tr><th>&nbsp;</th><th scope="col">d<span class="unicode" data-code-point="0251" title="U-0251: LATIN SMALL LETTER ALPHA">ɑ</span>te <span class="classname">DateTime</span></th><th scope="col">date2</th></tr>
716717
</thead>
717718
<tbody>
718719
<tr><th class="t_int t_key text-right" scope="row">0</th><td class="t_string">1955-11-05T00:00:00%i:00</td><td class="t_string">not a datetime</td></tr>
@@ -722,17 +723,17 @@ public static function providerTestMethod()
722723
</li>',
723724
'text' => 'not all col values of same type = array(
724725
[0] => array(
725-
[date] => "1955-11-05T00:00:00%i:00"
726+
[d\u{0251}te] => "1955-11-05T00:00:00%i:00"
726727
[date2] => "not a datetime"
727728
)
728729
[1] => array(
729-
[date] => "1985-10-26T00:00:00%i:00"
730+
[d\u{0251}te] => "1985-10-26T00:00:00%i:00"
730731
[date2] => "2015-10-21T00:00:00%i:00"
731732
)
732733
)',
733734
'script' => 'console.log("%%cnot all col values of same type", "' . self::$captionStyle . '")' . "\n"
734-
. 'console.table([{"date":"1955-11-05T00:00:00%i:00","date2":"not a datetime"},{"date":"1985-10-26T00:00:00%i:00","date2":"2015-10-21T00:00:00%i:00"}]);',
735-
'firephp' => 'X-Wf-1-1-1-8: 191|[{"Label":"not all col values of same type","Type":"TABLE"},[["","date","date2"],[0,"1955-11-05T00:00:00%i:00","not a datetime"],[1,"1985-10-26T00:00:00%i:00","2015-10-21T00:00:00%i:00"]]]|',
735+
. 'console.table([{"d\\\u{0251}te":"1955-11-05T00:00:00%i:00","date2":"not a datetime"},{"d\\\u{0251}te":"1985-10-26T00:00:00%i:00","date2":"2015-10-21T00:00:00%i:00"}]);',
736+
'firephp' => 'X-Wf-1-1-1-8: 199|[{"Label":"not all col values of same type","Type":"TABLE"},[["","d\\\u{0251}te","date2"],[0,"1955-11-05T00:00:00%i:00","not a datetime"],[1,"1985-10-26T00:00:00%i:00","2015-10-21T00:00:00%i:00"]]]|',
736737
),
737738
),
738739

0 commit comments

Comments
 (0)