From f444f651e5eb34a8aa41e398c7790ed0435cf84b Mon Sep 17 00:00:00 2001 From: fusionate Date: Mon, 29 May 2023 22:23:40 +0000 Subject: [PATCH] TCPDF: Updates for PHP 8.1 --- resources/tcpdf/include/tcpdf_static.php | 6 +++--- resources/tcpdf/tcpdf.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/tcpdf/include/tcpdf_static.php b/resources/tcpdf/include/tcpdf_static.php index 8b82eecefb..feabb11a1c 100644 --- a/resources/tcpdf/include/tcpdf_static.php +++ b/resources/tcpdf/include/tcpdf_static.php @@ -1136,7 +1136,7 @@ class TCPDF_STATIC { * @see setHtmlVSpace() * @public static */ - public static function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='', &$tagvspaces) { + public static function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='', &$tagvspaces=[]) { // configure parameters for HTML Tidy if ($tidy_options === '') { $tidy_options = array ( @@ -1787,7 +1787,7 @@ class TCPDF_STATIC { * @since 6.0.023 * @public static */ - public static function pregSplit($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL) { + public static function pregSplit($pattern, $modifiers, $subject, $limit=-1, $flags=0) { // the bug only happens on PHP 5.2 when using the u modifier if ((strpos($modifiers, 'u') === FALSE) OR (count(preg_split('//u', "\n\t", -1, PREG_SPLIT_NO_EMPTY)) == 2)) { return preg_split($pattern.$modifiers, $subject, $limit, $flags); @@ -2485,7 +2485,7 @@ class TCPDF_STATIC { * @since 5.0.010 (2010-05-17) * @public static */ - public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false, $k, $pagedim=array()) { + public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false, $k=1, $pagedim=array()) { if (!isset($pagedim[$page])) { // initialize array $pagedim[$page] = array(); diff --git a/resources/tcpdf/tcpdf.php b/resources/tcpdf/tcpdf.php index 859694a45f..326fa7f6ef 100644 --- a/resources/tcpdf/tcpdf.php +++ b/resources/tcpdf/tcpdf.php @@ -4134,8 +4134,8 @@ class TCPDF { // SHY character will not be printed return (0); } - if (isset($this->CurrentFont['cw'][$char])) { - $w = $this->CurrentFont['cw'][$char]; + if (isset($this->CurrentFont['cw'][floor($char)])) { + $w = $this->CurrentFont['cw'][floor($char)]; } elseif (isset($this->CurrentFont['dw'])) { // default width $w = $this->CurrentFont['dw']; @@ -7039,7 +7039,7 @@ class TCPDF { } if ($newimage) { //First use of image, get info - $type = strtolower($type); + $type = strtolower($type ?? ''); if ($type == '') { $type = TCPDF_IMAGES::getImageFileType($file, $imsize); } elseif ($type == 'jpg') {