tecnickcom / TCPDF

Official clone of PHP library to generate PDF documents and barcodes
https://tcpdf.org
Other
4.22k stars 1.52k forks source link

array_push(): Argument #1 ($array) must be of type array, null given #560

Open jrchamp opened 2 years ago

jrchamp commented 2 years ago

Here's where the TypeError is being thrown: https://github.com/tecnickcom/TCPDF/blob/cc54c1503685e618b23922f53635f46e87653662/tcpdf.php#L18344

Here's the basic initialization that I added immediately before the array_push() line so that it would at least have an empty array instead of null.

                        if (!isset($dom[$trid]['cellpos'])) {
                            $dom[$trid]['cellpos'] = array();
                        }
jrchamp commented 2 years ago

This may be a duplicate of #439 which may also mean that my "fix" is resulting in a document that is not showing overflowed content.

jrchamp commented 2 years ago

I found the cause - poorly formed HTML really messes everything up:

<table>
  <tr>
    <td>
      <td>Text</td>
    </td>
  </tr>
</table>
Amrita1991 commented 1 year ago

We have experienced this problem as well. I have tested out fix from @jrchamp and it has worked for us.

irfanzabidin commented 1 year ago

worked like a charm, thanks a lot @jrchamp