pauln / tcpdi_parser

Parser for use with TCPDI, based on TCPDF_PARSER
GNU Lesser General Public License v3.0
27 stars 47 forks source link

PHP 7.2 error: A non-numeric value encountered (tcpdi_parser.php( line 1052 )) #22

Open michaelklopf opened 6 years ago

michaelklopf commented 6 years ago

I've got a special set of pdfs which cause this error in the following line:

https://github.com/pauln/tcpdi_parser/blob/c7c3e86cd1a15c293ae8246d32caaae3e8b27db6/tcpdi_parser.php#L1052

It should be related to the warning here: http://php.net/manual/en/migration71.other-changes.php

According to XDebug it tries to do the following but fails:

$this->objstreamobjs["x��XmO#G�޿��/Ec�K�[EbḠܲ(���"] = [[3, 0], 218];
michaelklopf commented 6 years ago

Suppressing this error with @ gets me further, but is this a best practice here?

     $this->objstreamobjs[$ints[$j-1]] = @array($key, $ints[$j]+$first);
supergert commented 5 years ago

I encountered this same issue today (tcpdi_parser.php version 1.1). It turns out to be inside the function decodeStream(). If the $sdic contains a /Filter with an array of filters ($v[0] = PDF_TYPE_ARRAY), it is skipped because of line 1132: if ($v[0] == PDF_TYPE_TOKEN) { Not sure why this line is needed at all in decodeStream().