From 2dc30ba64fb58bfdb663a86f2653a309a2dbf4b4 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Sat, 26 Oct 2024 10:43:56 +0100 Subject: [PATCH 1/3] Ayesh: [PHP 8.4] Fix: Curl CURLOPT_BINARYTRANSFER deprecated #675 --- include/tcpdf_static.php | 1 - 1 file changed, 1 deletion(-) diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index 4cee355e..395bb958 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -1961,7 +1961,6 @@ public static function fileGetContents($file) { // try to get remote file data using cURL $crs = curl_init(); curl_setopt($crs, CURLOPT_URL, $path); - curl_setopt($crs, CURLOPT_BINARYTRANSFER, true); curl_setopt($crs, CURLOPT_FAILONERROR, true); curl_setopt($crs, CURLOPT_RETURNTRANSFER, true); if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) { From a94a9a0b29bce110cd24157b4c12e2d73a567a1c Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Sat, 26 Oct 2024 11:27:07 +0100 Subject: [PATCH 2/3] THenkeDE: SVG detection fix for inline data images #646 --- tcpdf.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcpdf.php b/tcpdf.php index 1abf622a..eef39154 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -19055,7 +19055,7 @@ protected function openHTMLTagHandler($dom, $key, $cell) { if ($imgsrc[0] === '@') { // data stream $imgsrc = '@'.base64_decode(substr($imgsrc, 1)); - $type = ''; + $type = preg_match('/]*)>/si', $imgsrc) ? 'svg' : ''; } else if (preg_match('@^data:image/([^;]*);base64,(.*)@', $imgsrc, $reg)) { $imgsrc = '@'.base64_decode($reg[2]); $type = $reg[1]; From 52a029e80307d5d80f23a4c62adfd510891cb085 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Sat, 26 Oct 2024 11:33:55 +0100 Subject: [PATCH 3/3] bruno-farias: Fix count svg #647 --- tcpdf.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tcpdf.php b/tcpdf.php index eef39154..af5beb97 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -23445,8 +23445,8 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 $cy -= $h; } $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), ($cy * $this->k))); - if (count($gradient['stops']) > 1) { - $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false); + if ((is_array($gradient['stops']) || $gradient['stops'] instanceof Countable) && count($gradient['stops']) > 1) { + $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops']); } } elseif ($svgstyle['fill'] != 'none') { $fill_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['fill'], $this->spot_colors);