N°2329 Update TCPDF to version fixing unlink bug

Was updated to 6.3.2 fot PHP 7.4 compat, but this version had a regression (issue 159 in the original repo)
This commit integrates 6.3.4 that includes a fix for issue 159
This commit is contained in:
Pierre Goiffon
2020-02-12 15:22:09 +01:00
parent 166986f336
commit 133d267aca
12 changed files with 110 additions and 51 deletions

View File

@@ -10,7 +10,7 @@
"ext-json": "*",
"ext-mysqli": "*",
"ext-soap": "*",
"combodo/tcpdf": "6.3.2",
"combodo/tcpdf": "6.3.4",
"nikic/php-parser": "^3.1",
"pear/archive_tar": "1.4.9",
"pelago/emogrifier": "2.1.0",

19
composer.lock generated
View File

@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "3e413c47265b246174add07c2c91b5e9",
"content-hash": "b29eb2767d269b9ec2cf4d148dc083bc",
"packages": [
{
"name": "combodo/tcpdf",
"version": "6.3.2",
"version": "6.3.4",
"source": {
"type": "git",
"url": "https://github.com/combodo-itop-libs/TCPDF.git",
"reference": "2723050de47c8cbd78293656d896c0000442e23a"
"reference": "fe1c625d33e8f7d872d6fb69fb0255fd0e5cee2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/2723050de47c8cbd78293656d896c0000442e23a",
"reference": "2723050de47c8cbd78293656d896c0000442e23a",
"url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/fe1c625d33e8f7d872d6fb69fb0255fd0e5cee2d",
"reference": "fe1c625d33e8f7d872d6fb69fb0255fd0e5cee2d",
"shasum": ""
},
"require": {
@@ -49,9 +49,14 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
"LGPL-3.0-only"
],
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
},
{
"name": "Combodo",
"email": "contact@combodo.com"
@@ -59,7 +64,7 @@
],
"description": "TCPDF fork adding requirements for iTop: Specific fonts.",
"homepage": "https://github.com/combodo-itop-libs/TCPDF",
"time": "2020-01-08T16:22:40+00:00"
"time": "2020-02-12T14:16:56+00:00"
},
{
"name": "nikic/php-parser",

1
lib/combodo/tcpdf/.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_donations&currency_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20tcpdf%20project']

1
lib/combodo/tcpdf/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.idea

View File

@@ -1 +1 @@
6.3.2
6.3.4

View File

@@ -6,8 +6,13 @@
"homepage": "https://github.com/combodo-itop-libs/TCPDF",
"type": "library",
"description": "TCPDF fork adding requirements for iTop: Specific fonts.",
"license": "LGPL-3.0",
"license": "LGPL-3.0-only",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
},
{
"name": "Combodo",
"email": "contact@combodo.com"

View File

@@ -629,7 +629,7 @@ class Datamatrix {
if ($numch[ENC_C40] == $numch[ENC_X12]) {
$k = ($pos + $charscount + 1);
while ($k < $data_length) {
$tmpchr = ord($data{$k});
$tmpchr = ord($data[$k]);
if ($this->isCharMode($tmpchr, ENC_X12)) {
return ENC_X12;
} elseif (!($this->isCharMode($tmpchr, ENC_X12) OR $this->isCharMode($tmpchr, ENC_C40))) {

View File

@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_static.php
// Version : 1.1.3
// Version : 1.1.4
// Begin : 2002-08-03
// Last Update : 2015-04-28
// Last Update : 2019-11-01
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.3.2';
private static $tcpdf_version = '6.3.4';
/**
* String alias for total number of pages.
@@ -1829,6 +1829,8 @@ class TCPDF_STATIC {
*/
public static function url_exists($url) {
$crs = curl_init();
// encode query params in URL to get right response form the server
$url = self::encodeUrlQuery($url);
curl_setopt($crs, CURLOPT_URL, $url);
curl_setopt($crs, CURLOPT_NOBODY, true);
curl_setopt($crs, CURLOPT_FAILONERROR, true);
@@ -1846,6 +1848,26 @@ class TCPDF_STATIC {
return ($code == 200);
}
/**
* Encode query params in URL
*
* @param string $url
* @return string
* @since 6.3.3 (2019-11-01)
* @public static
*/
public static function encodeUrlQuery($url) {
$urlData = parse_url($url);
if (isset($urlData['query']) && $urlData['query']) {
$urlQueryData = [];
parse_str(urldecode($urlData['query']), $urlQueryData);
$updatedUrl = $urlData['scheme'] . '://' . $urlData['host'] . $urlData['path'] . '?' . http_build_query($urlQueryData);
} else {
$updatedUrl = $url;
}
return $updatedUrl;
}
/**
* Wrapper for file_exists.
* Checks whether a file or directory exists.

View File

@@ -4715,14 +4715,14 @@ class TCPDF {
* Defines the page and position a link points to.
* @param $link (int) The link identifier returned by AddLink()
* @param $y (float) Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page)
* @param $page (int) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
* @param $page (int|string) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
* @public
* @since 1.5
* @see AddLink()
*/
public function SetLink($link, $y=0, $page=-1) {
$fixed = false;
if (!empty($page) AND ($page[0] == '*')) {
if (!empty($page) AND (substr($page, 0, 1) == '*')) {
$page = intval(substr($page, 1));
// this page number will not be changed when moving/add/deleting pages
$fixed = true;
@@ -7165,31 +7165,20 @@ class TCPDF {
$info['i'] = $this->setImageBuffer($file, $info);
}
// set alignment
$this->img_rb_x = $x + $w;
$this->img_rb_y = $y + $h;
// set alignment
if ($this->rtl) {
if ($palign == 'L') {
$ximg = $this->lMargin;
} elseif ($palign == 'C') {
$ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
} elseif ($palign == 'R') {
$ximg = $this->w - $this->rMargin - $w;
} else {
$ximg = $x - $w;
}
$this->img_rb_x = $ximg;
if ($palign == 'L') {
$ximg = $this->lMargin;
} elseif ($palign == 'C') {
$ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
} elseif ($palign == 'R') {
$ximg = $this->w - $this->rMargin - $w;
} else {
if ($palign == 'L') {
$ximg = $this->lMargin;
} elseif ($palign == 'C') {
$ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
} elseif ($palign == 'R') {
$ximg = $this->w - $this->rMargin - $w;
} else {
$ximg = $x;
}
$this->img_rb_x = $ximg + $w;
$ximg = $x;
}
if ($ismask OR $hidden) {
// image is not displayed
return $info['i'];
@@ -7788,7 +7777,7 @@ class TCPDF {
if ($destroyall AND !$preserve_objcopy) {
self::$cleaned_ids[$this->file_id] = true;
// remove all temporary files
if ($handle = opendir(K_PATH_CACHE)) {
if ($handle = @opendir(K_PATH_CACHE)) {
while ( false !== ( $file_name = readdir( $handle ) ) ) {
if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) {
unlink(K_PATH_CACHE.$file_name);
@@ -7798,7 +7787,9 @@ class TCPDF {
}
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
if(substr($file, 0 , strlen(K_PATH_CACHE)) === K_PATH_CACHE && is_file($file)) unlink($file);
if (strpos($file, K_PATH_CACHE) === 0) {
@unlink($file);
}
}
}
}
@@ -7809,6 +7800,7 @@ class TCPDF {
'bufferlen',
'buffer',
'cached_files',
'imagekeys',
'sign',
'signature_data',
'signature_max_length',
@@ -9638,6 +9630,16 @@ class TCPDF {
$xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>'."\n";
$xmp .= "\t\t\t\t\t\t".'<pdfaSchema:prefix>pdf</pdfaSchema:prefix>'."\n";
$xmp .= "\t\t\t\t\t\t".'<pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>'."\n";
$xmp .= "\t\t\t\t\t\t".'<pdfaSchema:property>'."\n";
$xmp .= "\t\t\t\t\t\t\t".'<rdf:Seq>'."\n";
$xmp .= "\t\t\t\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
$xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:category>internal</pdfaProperty:category>'."\n";
$xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:description>Adobe PDF Schema</pdfaProperty:description>'."\n";
$xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:name>InstanceID</pdfaProperty:name>'."\n";
$xmp .= "\t\t\t\t\t\t\t\t\t".'<pdfaProperty:valueType>URI</pdfaProperty:valueType>'."\n";
$xmp .= "\t\t\t\t\t\t\t\t".'</rdf:li>'."\n";
$xmp .= "\t\t\t\t\t\t\t".'</rdf:Seq>'."\n";
$xmp .= "\t\t\t\t\t\t".'</pdfaSchema:property>'."\n";
$xmp .= "\t\t\t\t\t".'</rdf:li>'."\n";
$xmp .= "\t\t\t\t\t".'<rdf:li rdf:parseType="Resource">'."\n";
$xmp .= "\t\t\t\t\t\t".'<pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>'."\n";
@@ -12279,7 +12281,7 @@ class TCPDF {
$x = $this->w;
}
$fixed = false;
if (!empty($page) AND ($page[0] == '*')) {
if (!empty($page) AND (substr($page, 0, 1) == '*')) {
$page = intval(substr($page, 1));
// this page number will not be changed when moving/add/deleting pages
$fixed = true;
@@ -12382,7 +12384,7 @@ class TCPDF {
$x = $this->w;
}
$fixed = false;
if (!empty($page) AND ($page[0] == '*')) {
if ((string)$page && (((string)$page)[0] == '*')) {
$page = intval(substr($page, 1));
// this page number will not be changed when moving/add/deleting pages
$fixed = true;
@@ -23406,7 +23408,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
*/
protected function SVGPath($d, $style='') {
if ($this->state != 2) {
return;
return;
}
// set fill/stroke style
$op = TCPDF_STATIC::getPathPaintOperator($style, '');
@@ -23426,6 +23428,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$xmax = 0;
$ymin = 2147483647;
$ymax = 0;
$xinitial = 0;
$yinitial = 0;
$relcoord = false;
$minlen = (0.01 / $this->k); // minimum acceptable length (3 point)
$firstcmd = true; // used to print first point
@@ -23470,6 +23474,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
if ($ck == 1) {
$this->_outPoint($x, $y);
$firstcmd = false;
$xinitial = $x;
$yinitial = $y;
} else {
$this->_outLine($x, $y);
}
@@ -23657,8 +23663,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
if ((($ck + 1) % 7) == 0) {
$x0 = $x;
$y0 = $y;
$rx = abs($params[($ck - 6)]);
$ry = abs($params[($ck - 5)]);
$rx = max(abs($params[($ck - 6)]), .000000001);
$ry = max(abs($params[($ck - 5)]), .000000001);
$ang = -$rawparams[($ck - 4)];
$angle = deg2rad($ang);
$fa = $rawparams[($ck - 3)]; // large-arc-flag
@@ -23745,6 +23751,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
}
case 'Z': {
$this->_out('h');
$x = $x0 = $xinitial;
$y = $y0 = $yinitial;
break;
}
}

View File

@@ -6,8 +6,12 @@ $vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'AbstractApplicationObjectExtension' => $baseDir . '/application/applicationextension.inc.php',
'AbstractApplicationUIExtension' => $baseDir . '/application/applicationextension.inc.php',
'AbstractLoginFSMExtension' => $baseDir . '/application/applicationextension.inc.php',
'AbstractPageUIExtension' => $baseDir . '/application/applicationextension.inc.php',
'AbstractPortalUIExtension' => $baseDir . '/application/applicationextension.inc.php',
'AbstractPreferencesExtension' => $baseDir . '/application/applicationextension.inc.php',
'AbstractWeeklyScheduledProcess' => $baseDir . '/core/backgroundprocess.inc.php',
'Action' => $baseDir . '/core/action.class.inc.php',
'ActionChecker' => $baseDir . '/core/userrights.class.inc.php',
@@ -148,6 +152,7 @@ return array(
'Combodo\\iTop\\TwigExtension' => $baseDir . '/application/twigextension.class.inc.php',
'Config' => $baseDir . '/core/config.class.inc.php',
'ConfigException' => $baseDir . '/core/config.class.inc.php',
'ConfigPlaceholdersResolver' => $baseDir . '/core/config.class.inc.php',
'Console_Getopt' => $vendorDir . '/pear/console_getopt/Console/Getopt.php',
'ContextTag' => $baseDir . '/core/contexttag.class.inc.php',
'CoreCannotSaveObjectException' => $baseDir . '/core/coreexception.class.inc.php',
@@ -2109,6 +2114,7 @@ return array(
'ValueSetDefinition' => $baseDir . '/core/valuesetdef.class.inc.php',
'ValueSetEnum' => $baseDir . '/core/valuesetdef.class.inc.php',
'ValueSetEnumClasses' => $baseDir . '/core/valuesetdef.class.inc.php',
'ValueSetEnumPadded' => $baseDir . '/core/valuesetdef.class.inc.php',
'ValueSetObjects' => $baseDir . '/core/valuesetdef.class.inc.php',
'ValueSetRange' => $baseDir . '/core/valuesetdef.class.inc.php',
'VariableExpression' => $baseDir . '/core/oql/expression.class.inc.php',

View File

@@ -236,8 +236,12 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
);
public static $classMap = array (
'AbstractApplicationObjectExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'AbstractApplicationUIExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'AbstractLoginFSMExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'AbstractPageUIExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'AbstractPortalUIExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'AbstractPreferencesExtension' => __DIR__ . '/../..' . '/application/applicationextension.inc.php',
'AbstractWeeklyScheduledProcess' => __DIR__ . '/../..' . '/core/backgroundprocess.inc.php',
'Action' => __DIR__ . '/../..' . '/core/action.class.inc.php',
'ActionChecker' => __DIR__ . '/../..' . '/core/userrights.class.inc.php',
@@ -378,6 +382,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'Combodo\\iTop\\TwigExtension' => __DIR__ . '/../..' . '/application/twigextension.class.inc.php',
'Config' => __DIR__ . '/../..' . '/core/config.class.inc.php',
'ConfigException' => __DIR__ . '/../..' . '/core/config.class.inc.php',
'ConfigPlaceholdersResolver' => __DIR__ . '/../..' . '/core/config.class.inc.php',
'Console_Getopt' => __DIR__ . '/..' . '/pear/console_getopt/Console/Getopt.php',
'ContextTag' => __DIR__ . '/../..' . '/core/contexttag.class.inc.php',
'CoreCannotSaveObjectException' => __DIR__ . '/../..' . '/core/coreexception.class.inc.php',
@@ -2339,6 +2344,7 @@ class ComposerStaticInit0018331147de7601e7552f7da8e3bb8b
'ValueSetDefinition' => __DIR__ . '/../..' . '/core/valuesetdef.class.inc.php',
'ValueSetEnum' => __DIR__ . '/../..' . '/core/valuesetdef.class.inc.php',
'ValueSetEnumClasses' => __DIR__ . '/../..' . '/core/valuesetdef.class.inc.php',
'ValueSetEnumPadded' => __DIR__ . '/../..' . '/core/valuesetdef.class.inc.php',
'ValueSetObjects' => __DIR__ . '/../..' . '/core/valuesetdef.class.inc.php',
'ValueSetRange' => __DIR__ . '/../..' . '/core/valuesetdef.class.inc.php',
'VariableExpression' => __DIR__ . '/../..' . '/core/oql/expression.class.inc.php',

View File

@@ -1,17 +1,17 @@
[
{
"name": "combodo/tcpdf",
"version": "6.3.2",
"version_normalized": "6.3.2.0",
"version": "6.3.4",
"version_normalized": "6.3.4.0",
"source": {
"type": "git",
"url": "https://github.com/combodo-itop-libs/TCPDF.git",
"reference": "2723050de47c8cbd78293656d896c0000442e23a"
"reference": "fe1c625d33e8f7d872d6fb69fb0255fd0e5cee2d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/2723050de47c8cbd78293656d896c0000442e23a",
"reference": "2723050de47c8cbd78293656d896c0000442e23a",
"url": "https://api.github.com/repos/combodo-itop-libs/TCPDF/zipball/fe1c625d33e8f7d872d6fb69fb0255fd0e5cee2d",
"reference": "fe1c625d33e8f7d872d6fb69fb0255fd0e5cee2d",
"shasum": ""
},
"require": {
@@ -20,7 +20,7 @@
"replace": {
"tecnickcom/tcpdf": "self.version"
},
"time": "2020-01-08T16:22:40+00:00",
"time": "2020-02-12T14:16:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@@ -45,9 +45,14 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
"LGPL-3.0-only"
],
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
},
{
"name": "Combodo",
"email": "contact@combodo.com"