php 修复第 16498 行中 TCPDF 的小错误:未定义的索引:线程

php fixing mini error of TCPDF in line 16498: Undefined index: thread

创建 pdf 时可能出现错误,我需要面对它。

PHP version 5.3

TCPDF version 6.2

if (($dom[$key]['value'] == 'table') AND (!TCPDF_STATIC::empty_string($dom[($dom[$key]['parent'])]['thead'])) ) 
   {
         $dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
        $dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
   }

这里是只需要检查数组元素的解决方案。

if (array_key_exists ('thead',$dom[($dom[$key]['parent'])]))
{
                    if (($dom[$key]['value'] == 'table') AND (!TCPDF_STATIC::empty_string($dom[($dom[$key]['parent'])]['thead'])) ) {
                    $dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
                    $dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
                    }
}