From 9e8861b4dc124c020ff63ab944cdba1ed22ccd65 Mon Sep 17 00:00:00 2001 From: Przemek Peron Date: Thu, 1 Oct 2020 20:27:02 +0200 Subject: [PATCH] Fix for PHP 7.4 --- tcpdf.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tcpdf.php b/tcpdf.php index 8b7d812..1ce3838 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -6866,6 +6866,12 @@ class TCPDF { list($x, $y) = $this->checkPageRegions($h, $x, $y); $exurl = ''; // external streams $imsize = FALSE; + + // Make sure the file variable is not empty or null because accessing $file[0] later + // results in error when running PHP 7.4 + if (empty($file)) { + return false; + } // check if we are passing an image as file or string if ($file[0] === '@') { // image from string