From 9b97cf38c8a1287af3b448f1cdf95299fd4581cc Mon Sep 17 00:00:00 2001 From: Ferdinand Date: Tue, 14 Apr 2026 16:53:00 +0200 Subject: [PATCH] Fix curve parameter extraction once more The switch from `preg_match_all` to `preg_split` in PR #855 broke parsing of "optimized" svg paths. In these, the "-" can be used as delimiter between numbers as well. --- tcpdf.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tcpdf.php b/tcpdf.php index cffe210d2..fbd47c36c 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -23726,10 +23726,8 @@ protected function SVGPath($d, $style='') { $params = array(); if (isset($val[2])) { // get curve parameters, see https://github.com/tecnickcom/TCPDF/issues/767 - $rawparams = preg_split('/([\,\s]+)/si', trim($val[2])); - $rawparams = array_filter($rawparams, function($p) { - return trim($p) != ''; - }); + preg_match_all('/[+-]?(?:\d*\.\d+|\d+\.?\d*)(?:[eE][+-]?\d+)?/', trim($val[2]), $matches); + $rawparams = $matches[0]; $params = array(); foreach ($rawparams as $ck => $cp) { $params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, false);