diff --git a/tcpdf.php b/tcpdf.php index cffe210d..a20ae9a5 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -19315,7 +19315,7 @@ protected function openHTMLTagHandler($dom, $key, $cell) { if ($key > 2) { $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag); } - if ($this->listordered[$this->listnum]) { + if (!empty($this->listordered[$this->listnum])) { // ordered item if (isset($parent['attribute']['type']) AND !TCPDF_STATIC::empty_string($parent['attribute']['type'])) { $this->lispacer = $parent['attribute']['type']; @@ -19326,6 +19326,9 @@ protected function openHTMLTagHandler($dom, $key, $cell) { } else { $this->lispacer = '#'; } + if (!isset($this->listcount[$this->listnum])) { + $this->listcount[$this->listnum] = 0; + } ++$this->listcount[$this->listnum]; if (isset($tag['attribute']['value'])) { $this->listcount[$this->listnum] = intval($tag['attribute']['value']); @@ -20686,7 +20689,7 @@ protected function putHtmlListBullet($listdepth, $listtype='', $size=10) { } elseif ($listtype == '!') { // set default list type for unordered list $deftypes = array('disc', 'circle', 'square'); - $listtype = $deftypes[($listdepth - 1) % 3]; + $listtype = $deftypes[max(0, ($listdepth - 1) % 3)]; } elseif ($listtype == '#') { // set default list type for ordered list $listtype = 'decimal'; @@ -20769,7 +20772,7 @@ protected function putHtmlListBullet($listdepth, $listtype='', $size=10) { // $textitem case '1': case 'decimal': { - $textitem = $this->listcount[$this->listnum]; + $textitem = $this->listcount[$this->listnum] ?? ''; break; } case 'decimal-leading-zero': { @@ -20830,7 +20833,7 @@ protected function putHtmlListBullet($listdepth, $listtype='', $size=10) { } */ default: { - $textitem = $this->listcount[$this->listnum]; + $textitem = $this->listcount[$this->listnum] ?? ''; } } if (!TCPDF_STATIC::empty_string($textitem)) {