ABP
ABP

Reputation: 744

TCPDF error on PHP Version 7

I'm using http://tcpdf.org plugin to generate PDF417 bar code in PHP.

But this plugin has an error in PHP 7. (In PHP 5.6 without error and works normal)

Here is the error:

And my code is:

require "tcpdf/tcpdf_barcodes_2d.php";
$barcodeObject=new TCPDF2DBarcode("12364524"),"PDF417");
$image=$barcodeObject->getBarcodePNG(10,5);

Upvotes: 2

Views: 2338

Answers (1)

ABP
ABP

Reputation: 744

To fix this error, we can edit this file: tcpdf/include/barcodes/pdf417.php (Line 747)

Old code:

$errsize = (2 << $ecl);
if ($maxerrsize >= $errsize)
{
    break;
}

New code:

if($ecl>=0)
{
    $errsize = (2 << $ecl);
    if ($maxerrsize >= $errsize)
    {
        break;
    }
}

Upvotes: 3

Related Questions