vendor: Update dompdf to a fixed version for PHP 7.3
https://github.com/dompdf/dompdf/pull/1854
This commit is contained in:
parent
ecfaf7cede
commit
f4f61dff5b
|
@ -1,16 +1,26 @@
|
||||||
GLOBIGNORE=$0; rm -rf *
|
#!/bin/bash
|
||||||
|
set -eux
|
||||||
|
#GLOBIGNORE=$0; rm -rf *
|
||||||
|
|
||||||
curl https://codeload.github.com/dompdf/dompdf/tar.gz/v0.8.2 -o dompdf-0.8.2.tar.gz
|
#DOMPDF_VERSION=0.8.2
|
||||||
tar xzf dompdf-0.8.2.tar.gz --strip-components 1 dompdf-0.8.2/{lib,src,LICENSE.LGPL}
|
DOMPDF_VERSION=6a77a427984f97743018ace3e095fbf0edaaee29 # https://github.com/dompdf/dompdf/pull/1854
|
||||||
rm dompdf-0.8.2.tar.gz
|
|
||||||
|
PHP_FONTLIB_VERSION=0.5.1
|
||||||
|
PHP_SVGLIB_VERSION=0.3.2
|
||||||
|
|
||||||
|
rm -rf lib/ src/
|
||||||
|
|
||||||
|
curl -LsS https://github.com/dompdf/dompdf/archive/"$DOMPDF_VERSION".tar.gz -o /tmp/dompdf.tar.gz
|
||||||
|
tar xf /tmp/dompdf.tar.gz --strip-components 1 dompdf-"$DOMPDF_VERSION"/{lib,src,LICENSE.LGPL}
|
||||||
|
rm /tmp/dompdf.tar.gz
|
||||||
mv LICENSE.LGPL LICENSE
|
mv LICENSE.LGPL LICENSE
|
||||||
|
|
||||||
curl https://codeload.github.com/PhenX/php-font-lib/tar.gz/0.5.1 -o php-font-lib-0.5.1.tar.gz
|
curl -LsS https://github.com/PhenX/php-font-lib/archive/"$PHP_FONTLIB_VERSION".tar.gz -o /tmp/php-font-lib.tar.gz
|
||||||
mkdir -p lib/php-font-lib
|
[ -d lib/php-font-lib ] || mkdir -p lib/php-font-lib
|
||||||
tar xzf php-font-lib-0.5.1.tar.gz --strip-components 1 -C lib/php-font-lib php-font-lib-0.5.1/{src,LICENSE}
|
tar xf /tmp/php-font-lib.tar.gz --strip-components 1 -C lib/php-font-lib php-font-lib-"$PHP_FONTLIB_VERSION"/{src,LICENSE}
|
||||||
rm php-font-lib-0.5.1.tar.gz
|
rm /tmp/php-font-lib.tar.gz
|
||||||
|
|
||||||
curl https://codeload.github.com/PhenX/php-svg-lib/tar.gz/v0.3.2 -o php-svg-lib-0.3.2.tar.gz
|
curl -LsS https://github.com/PhenX/php-svg-lib/archive/v"$PHP_SVGLIB_VERSION".tar.gz -o /tmp/php-svg-lib.tar.gz
|
||||||
mkdir -p lib/php-svg-lib
|
[ -d lib/php-svg-lib ] || mkdir -p lib/php-svg-lib
|
||||||
tar xzf php-svg-lib-0.3.2.tar.gz --strip-components 1 -C lib/php-svg-lib php-svg-lib-0.3.2/src
|
tar xf /tmp/php-svg-lib.tar.gz --strip-components 1 -C lib/php-svg-lib php-svg-lib-"$PHP_SVGLIB_VERSION"/src
|
||||||
rm php-svg-lib-0.3.2.tar.gz
|
rm /tmp/php-svg-lib.tar.gz
|
||||||
|
|
|
@ -464,28 +464,28 @@ class Cpdf
|
||||||
// Named with limited valid values
|
// Named with limited valid values
|
||||||
case 'NonFullScreenPageMode':
|
case 'NonFullScreenPageMode':
|
||||||
if (!in_array($v, array('UseNone', 'UseOutlines', 'UseThumbs', 'UseOC'))) {
|
if (!in_array($v, array('UseNone', 'UseOutlines', 'UseThumbs', 'UseOC'))) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
$o['info'][$k] = $v;
|
$o['info'][$k] = $v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Direction':
|
case 'Direction':
|
||||||
if (!in_array($v, array('L2R', 'R2L'))) {
|
if (!in_array($v, array('L2R', 'R2L'))) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
$o['info'][$k] = $v;
|
$o['info'][$k] = $v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'PrintScaling':
|
case 'PrintScaling':
|
||||||
if (!in_array($v, array('None', 'AppDefault'))) {
|
if (!in_array($v, array('None', 'AppDefault'))) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
$o['info'][$k] = $v;
|
$o['info'][$k] = $v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Duplex':
|
case 'Duplex':
|
||||||
if (!in_array($v, array('None', 'AppDefault'))) {
|
if (!in_array($v, array('None', 'AppDefault'))) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
$o['info'][$k] = $v;
|
$o['info'][$k] = $v;
|
||||||
break;
|
break;
|
||||||
|
@ -4801,12 +4801,12 @@ EOT;
|
||||||
imagesavealpha($img, false);
|
imagesavealpha($img, false);
|
||||||
|
|
||||||
// create temp alpha file
|
// create temp alpha file
|
||||||
$tempfile_alpha = tempnam($this->tmp, "cpdf_img_");
|
$tempfile_alpha = @tempnam($this->tmp, "cpdf_img_");
|
||||||
@unlink($tempfile_alpha);
|
@unlink($tempfile_alpha);
|
||||||
$tempfile_alpha = "$tempfile_alpha.png";
|
$tempfile_alpha = "$tempfile_alpha.png";
|
||||||
|
|
||||||
// create temp plain file
|
// create temp plain file
|
||||||
$tempfile_plain = tempnam($this->tmp, "cpdf_img_");
|
$tempfile_plain = @tempnam($this->tmp, "cpdf_img_");
|
||||||
@unlink($tempfile_plain);
|
@unlink($tempfile_plain);
|
||||||
$tempfile_plain = "$tempfile_plain.png";
|
$tempfile_plain = "$tempfile_plain.png";
|
||||||
|
|
||||||
|
|
|
@ -561,6 +561,25 @@ class CPDF implements Canvas
|
||||||
$this->_set_line_transparency("Normal", $this->_current_opacity);
|
$this->_set_line_transparency("Normal", $this->_current_opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw line at the specified coordinates on every page.
|
||||||
|
*
|
||||||
|
* See {@link Style::munge_color()} for the format of the colour array.
|
||||||
|
*
|
||||||
|
* @param float $x1
|
||||||
|
* @param float $y1
|
||||||
|
* @param float $x2
|
||||||
|
* @param float $y2
|
||||||
|
* @param array $color
|
||||||
|
* @param float $width
|
||||||
|
* @param array $style optional
|
||||||
|
*/
|
||||||
|
public function page_line($x1, $y1, $x2, $y2, $color, $width, $style = array())
|
||||||
|
{
|
||||||
|
$_t = 'line';
|
||||||
|
$this->_page_text[] = compact('_t', 'x1', 'y1', 'x2', 'y2', 'color', 'width', 'style');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param float $x
|
* @param float $x
|
||||||
* @param float $y
|
* @param float $y
|
||||||
|
@ -608,7 +627,7 @@ class CPDF implements Canvas
|
||||||
imageinterlace($im, false);
|
imageinterlace($im, false);
|
||||||
|
|
||||||
$tmp_dir = $this->_dompdf->getOptions()->getTempDir();
|
$tmp_dir = $this->_dompdf->getOptions()->getTempDir();
|
||||||
$tmp_name = tempnam($tmp_dir, "{$type}dompdf_img_");
|
$tmp_name = @tempnam($tmp_dir, "{$type}dompdf_img_");
|
||||||
@unlink($tmp_name);
|
@unlink($tmp_name);
|
||||||
$filename = "$tmp_name.png";
|
$filename = "$tmp_name.png";
|
||||||
$this->_image_cache[] = $filename;
|
$this->_image_cache[] = $filename;
|
||||||
|
@ -1092,6 +1111,10 @@ class CPDF implements Canvas
|
||||||
}
|
}
|
||||||
$eval->evaluate($code, array('PAGE_NUM' => $page_number, 'PAGE_COUNT' => $this->_page_count));
|
$eval->evaluate($code, array('PAGE_NUM' => $page_number, 'PAGE_COUNT' => $this->_page_count));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'line':
|
||||||
|
$this->line( $x1, $y1, $x2, $y2, $color, $width, $style );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -729,7 +729,7 @@ class GD implements Canvas
|
||||||
$func_name = "imagecreatefrom$img_type";
|
$func_name = "imagecreatefrom$img_type";
|
||||||
if (!function_exists($func_name)) {
|
if (!function_exists($func_name)) {
|
||||||
if (!method_exists("Dompdf\Helpers", $func_name)) {
|
if (!method_exists("Dompdf\Helpers", $func_name)) {
|
||||||
throw new \Exception("Function $func_name() not found. Cannot convert $type image: $img_url. Please install the image PHP extension.");
|
throw new \Exception("Function $func_name() not found. Cannot convert $img_type image: $img_url. Please install the image PHP extension.");
|
||||||
}
|
}
|
||||||
$func_name = "\\Dompdf\\Helpers::" . $func_name;
|
$func_name = "\\Dompdf\\Helpers::" . $func_name;
|
||||||
}
|
}
|
||||||
|
@ -978,6 +978,11 @@ class GD implements Canvas
|
||||||
// N/A
|
// N/A
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function page_line()
|
||||||
|
{
|
||||||
|
// N/A
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Streams the image to the client.
|
* Streams the image to the client.
|
||||||
*
|
*
|
||||||
|
|
|
@ -208,7 +208,7 @@ class PDFLib implements Canvas
|
||||||
$this->_pdf->begin_document("", "");
|
$this->_pdf->begin_document("", "");
|
||||||
} else {
|
} else {
|
||||||
$tmp_dir = $this->_dompdf->getOptions()->getTempDir();
|
$tmp_dir = $this->_dompdf->getOptions()->getTempDir();
|
||||||
$tmp_name = tempnam($tmp_dir, "libdompdf_pdf_");
|
$tmp_name = @tempnam($tmp_dir, "libdompdf_pdf_");
|
||||||
@unlink($tmp_name);
|
@unlink($tmp_name);
|
||||||
$this->_file = "$tmp_name.pdf";
|
$this->_file = "$tmp_name.pdf";
|
||||||
$this->_pdf->begin_document($this->_file, "");
|
$this->_pdf->begin_document($this->_file, "");
|
||||||
|
@ -762,6 +762,25 @@ class PDFLib implements Canvas
|
||||||
$this->_set_line_transparency("Normal", $this->_current_opacity);
|
$this->_set_line_transparency("Normal", $this->_current_opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw line at the specified coordinates on every page.
|
||||||
|
*
|
||||||
|
* See {@link Style::munge_color()} for the format of the colour array.
|
||||||
|
*
|
||||||
|
* @param float $x1
|
||||||
|
* @param float $y1
|
||||||
|
* @param float $x2
|
||||||
|
* @param float $y2
|
||||||
|
* @param array $color
|
||||||
|
* @param float $width
|
||||||
|
* @param array $style optional
|
||||||
|
*/
|
||||||
|
public function page_line($x1, $y1, $x2, $y2, $color, $width, $style = array())
|
||||||
|
{
|
||||||
|
$_t = 'line';
|
||||||
|
$this->_page_text[] = compact('_t', 'x1', 'y1', 'x2', 'y2', 'color', 'width', 'style');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param float $x1
|
* @param float $x1
|
||||||
* @param float $y1
|
* @param float $y1
|
||||||
|
@ -1259,6 +1278,11 @@ class PDFLib implements Canvas
|
||||||
}
|
}
|
||||||
$eval->evaluate($code, array('PAGE_NUM' => $p, 'PAGE_COUNT' => $this->_page_count));
|
$eval->evaluate($code, array('PAGE_NUM' => $p, 'PAGE_COUNT' => $this->_page_count));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'line':
|
||||||
|
$this->line( $x1, $y1, $x2, $y2, $color, $width, $style );
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1357,7 +1357,7 @@ class Stylesheet
|
||||||
$key = $page_selector;
|
$key = $page_selector;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
continue;
|
continue 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the style for later...
|
// Store the style for later...
|
||||||
|
|
|
@ -368,7 +368,7 @@ class Dompdf
|
||||||
|
|
||||||
$ext = strtolower(pathinfo($realfile, PATHINFO_EXTENSION));
|
$ext = strtolower(pathinfo($realfile, PATHINFO_EXTENSION));
|
||||||
if (!in_array($ext, $this->allowedLocalFileExtensions)) {
|
if (!in_array($ext, $this->allowedLocalFileExtensions)) {
|
||||||
throw new Exception("Permission denied on $file.");
|
throw new Exception("Permission denied on $file. This file extension is forbidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$realfile) {
|
if (!$realfile) {
|
||||||
|
@ -607,7 +607,7 @@ class Dompdf
|
||||||
if (!$accept) {
|
if (!$accept) {
|
||||||
//found at least one mediatype, but none of the accepted ones
|
//found at least one mediatype, but none of the accepted ones
|
||||||
//Skip this css file.
|
//Skip this css file.
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ class Dompdf
|
||||||
($media = $tag->getAttribute("media")) &&
|
($media = $tag->getAttribute("media")) &&
|
||||||
!in_array($media, $acceptedmedia)
|
!in_array($media, $acceptedmedia)
|
||||||
) {
|
) {
|
||||||
continue;
|
continue 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$css = "";
|
$css = "";
|
||||||
|
@ -945,7 +945,7 @@ class Dompdf
|
||||||
*
|
*
|
||||||
* @param array $options options (see above)
|
* @param array $options options (see above)
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function output($options = array())
|
public function output($options = array())
|
||||||
{
|
{
|
||||||
|
|
|
@ -186,7 +186,7 @@ class FontMetrics
|
||||||
$fontDir = $this->getOptions()->getFontDir();
|
$fontDir = $this->getOptions()->getFontDir();
|
||||||
$remoteHash = md5($remoteFile);
|
$remoteHash = md5($remoteFile);
|
||||||
$localFile = $fontDir . DIRECTORY_SEPARATOR . $remoteHash;
|
$localFile = $fontDir . DIRECTORY_SEPARATOR . $remoteHash;
|
||||||
$localTempFile = tempnam($this->options->get("tempDir"), "dompdf-font-");
|
$localTempFile = @tempnam($this->options->get("tempDir"), "dompdf-font-");
|
||||||
|
|
||||||
$cacheEntry = $localFile;
|
$cacheEntry = $localFile;
|
||||||
$localFile .= ".".strtolower(pathinfo(parse_url($remoteFile, PHP_URL_PATH),PATHINFO_EXTENSION));
|
$localFile .= ".".strtolower(pathinfo(parse_url($remoteFile, PHP_URL_PATH),PATHINFO_EXTENSION));
|
||||||
|
|
|
@ -515,7 +515,7 @@ class Page extends AbstractFrameDecorator
|
||||||
// parents of $frame must fit on the page as well:
|
// parents of $frame must fit on the page as well:
|
||||||
$p = $frame->get_parent();
|
$p = $frame->get_parent();
|
||||||
while ($p) {
|
while ($p) {
|
||||||
$max_y += $p->get_style()->computed_bottom_spacing();
|
$max_y += (float) $p->get_style()->computed_bottom_spacing();
|
||||||
$p = $p->get_parent();
|
$p = $p->get_parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Cache
|
||||||
} // From remote
|
} // From remote
|
||||||
else {
|
else {
|
||||||
$tmp_dir = $dompdf->getOptions()->getTempDir();
|
$tmp_dir = $dompdf->getOptions()->getTempDir();
|
||||||
$resolved_url = tempnam($tmp_dir, "ca_dompdf_img_");
|
$resolved_url = @tempnam($tmp_dir, "ca_dompdf_img_");
|
||||||
$image = "";
|
$image = "";
|
||||||
|
|
||||||
if ($data_uri) {
|
if ($data_uri) {
|
||||||
|
|
|
@ -401,7 +401,7 @@ abstract class AbstractRenderer
|
||||||
$this->_canvas->get_cpdf()->addImagePng($filedummy, $x, $this->_canvas->get_height() - $y - $height, $width, $height, $bg);
|
$this->_canvas->get_cpdf()->addImagePng($filedummy, $x, $this->_canvas->get_height() - $y - $height, $width, $height, $bg);
|
||||||
} else {
|
} else {
|
||||||
$tmp_dir = $this->_dompdf->getOptions()->getTempDir();
|
$tmp_dir = $this->_dompdf->getOptions()->getTempDir();
|
||||||
$tmp_name = tempnam($tmp_dir, "bg_dompdf_img_");
|
$tmp_name = @tempnam($tmp_dir, "bg_dompdf_img_");
|
||||||
@unlink($tmp_name);
|
@unlink($tmp_name);
|
||||||
$tmp_file = "$tmp_name.png";
|
$tmp_file = "$tmp_name.png";
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ class Text extends AbstractRenderer
|
||||||
|
|
||||||
switch ($text_deco) {
|
switch ($text_deco) {
|
||||||
default:
|
default:
|
||||||
continue;
|
continue 2;
|
||||||
|
|
||||||
case "underline":
|
case "underline":
|
||||||
$deco_y += $base - $descent + $underline_offset + $line_thickness / 2;
|
$deco_y += $base - $descent + $underline_offset + $line_thickness / 2;
|
||||||
|
|
Loading…
Reference in New Issue