If a class applies a table-cell format outside of a table, a fatal error is thrown:
Fatal error: Call to a member function get_cellmap() on a non-object in .../dompdf/include/table_cell_frame_reflower.cls.php on line 30
Repro document:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Crash cell test</title>
<style type="text/css" >
.about {
color: grey;
font-style: italic;
}
.highlight {
background-color: greenyellow;
display: table-cell;
}
</style>
</head>
<body>
<h1>Crash cell test</h1>
<p>This bug crashes the DOMPDF renderer.</p>
<p class="about">The <code>display: table-cell</code> property/value causes a fatal error
if the affected item is not actually in a table:</p>
<!-- CRASH HERE -->
<p>Here is <span class="highlight">a span</span> with no padding.</p>
<p class="about">A table cell however is fine (change the class of the span above to allow DOMPDF
to finish):</p>
<table>
<tr>
<td class="highlight">
Cell
</td>
</tr>
</table>
</body>
</html>
I'm on PHP 5.3.25 on Mac 10.6.8, running DOMPDF 54551d32450.
dompdf does not currently support anonymous table objects, though we do plan to support them in a future release (see issue #449). In the meantime you can work around the issue by filling out the necessary table structure. It requires extra markup that you don't need with the web browser, but it does address the issue:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Crash cell test</title>
<style type="text/css" >
.table {
display: table;
}
.tr {
display: table-row;
}
.highlight {
background-color: greenyellow;
display: table-cell;
}
</style>
</head>
<body>
<!-- NO MORE CRASH HERE -->
<p>Here is <span class="table"><span class="tr"><span class="highlight">a span</span></span></span> with no padding.</p>
</body>
</html>
Ah righto, thanks. I found I didn't need this one in the end, so feel free to close this if it dups the other ticket. Just thought I'd raise it in case it'd not already been found.
+1 on this fix. thanks!
thank Mister @bsweeney bsweeney
Most helpful comment
dompdf does not currently support anonymous table objects, though we do plan to support them in a future release (see issue #449). In the meantime you can work around the issue by filling out the necessary table structure. It requires extra markup that you don't need with the web browser, but it does address the issue: