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

346 views Asked by At

There is an error which may occur in the creating pdf and i need to face it.

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>';
   }
1

There are 1 answers

0
Jacky Shek On BEST ANSWER

Here is the solution which just need to check the array element.

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>';
                    }
}