From 91c9bba7fbc993df74f241686a051a5b111fca86 Mon Sep 17 00:00:00 2001 From: medarob <33951787+medarob@users.noreply.github.com> Date: Wed, 25 Mar 2026 16:34:25 +0100 Subject: [PATCH] Update tcpdf.php for undefined array key Core: Error handler (FE): PHP Warning: Undefined array key 0 in /var/www/typo3/vendor/tecnickcom/tcpdf/tcpdf.php line 20833 Core: Error handler (FE): PHP Warning: Undefined array key -1 in /var/www/typo3/vendor/tecnickcom/tcpdf/tcpdf.php line 20689 Core: Error handler (FE): PHP Warning: Undefined array key 0 in /var/www/typo3/vendor/tecnickcom/tcpdf/tcpdf.php line 19318 --- tcpdf.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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)) {