Skip to content

Commit fe3af15

Browse files
Sven Hagemannjschroed91
authored andcommitted
Fixed issue where the differ crashed when comparing two table columns containing a regular space character (#55)
1 parent 272a3ba commit fe3af15

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

lib/Caxy/HtmlDiff/Table/TableDiff.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ protected function htmlFromNode($node)
733733
protected function setInnerHtml($node, $html)
734734
{
735735
// DOMDocument::loadHTML does not allow empty strings.
736-
if (strlen($html) === 0) {
736+
if (strlen(trim($html)) === 0) {
737737
$html = '<span class="empty"></span>';
738738
}
739739

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<oldText>
2+
<table class="Standaardtabel">
3+
<tbody>
4+
<tr>
5+
<td> </td>
6+
<td>DDD</td>
7+
<td>ABC</td>
8+
<td>DEF</td>
9+
</tr>
10+
</tbody>
11+
</table>
12+
</oldText>
13+
14+
<newText>
15+
<table class="Standaardtabel">
16+
<tbody>
17+
<tr>
18+
<td> </td>
19+
<td>ZXY</td>
20+
<td>ABC</td>
21+
<td>DEF</td>
22+
</tr>
23+
</tbody>
24+
</table>
25+
</newText>
26+
27+
<expected>
28+
<table class="Standaardtabel"><tr><td rowspan="1" colspan="1"><span class="empty"></span></td><td rowspan="1" colspan="1"><del class="diffmod">DDD </del><ins class="diffmod">ZXY </ins></td><td rowspan="1" colspan="1"><p>ABC</p></td><td rowspan="1" colspan="1"><p>DEF</p></td></tr></table>
29+
</expected>

0 commit comments

Comments
 (0)