summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-12-21 09:57:57 +0100
committerRemi Collet <remi@remirepo.net>2017-12-21 09:57:57 +0100
commite8216295565399e46b0a315087aa71b42751fcfc (patch)
tree6f6eeb963f5c85746e85ac6e10ffd7d8d6e93773
parentfacb5cff970f4aaa8aabdfba9dc76ae6674f6edd (diff)
add patch for PHP 7.2 from https://github.com/tecnickcom/TCPDF/pull/74/files
disable opcache caching for fonts
-rw-r--r--.gitignore8
-rw-r--r--74.patch50
-rw-r--r--composer.json40
-rw-r--r--php-tcpdf.spec17
4 files changed, 114 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/74.patch b/74.patch
new file mode 100644
index 0000000..76b8d60
--- /dev/null
+++ b/74.patch
@@ -0,0 +1,50 @@
+From 487465117861fa9711a0281b8b9eabfed53ce9b0 Mon Sep 17 00:00:00 2001
+From: Emiel Molenaar <emiel.molenaar@gmail.com>
+Date: Thu, 21 Sep 2017 12:10:50 +0200
+Subject: [PATCH] Refactor deprecated each() calls to foreach()
+
+---
+ tcpdf.php | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/tcpdf.php b/tcpdf.php
+index 65196e74..f3dc2314 100644
+--- a/tcpdf.php
++++ b/tcpdf.php
+@@ -12582,7 +12582,7 @@ protected function _addfield($type, $name, $x, $y, $w, $h, $prop) {
+ $k = $this->k;
+ $this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n";
+ $this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n";
+- while (list($key, $val) = each($prop)) {
++ foreach($prop as $key => $val) {
+ if (strcmp(substr($key, -5), 'Color') == 0) {
+ $val = TCPDF_COLORS::_JScolor($val);
+ } else {
+@@ -16545,9 +16545,9 @@ protected function getHtmlDomArray($html) {
+ // get attributes
+ preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
+ $dom[$key]['attribute'] = array(); // reset attribute array
+- while (list($id, $name) = each($attr_array[1])) {
+- $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
+- }
++ foreach($attr_array[1] as $id => $name) {
++ $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
++ }
+ if (!empty($css)) {
+ // merge CSS style to current style
+ list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css);
+@@ -16558,10 +16558,10 @@ protected function getHtmlDomArray($html) {
+ // get style attributes
+ preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
+ $dom[$key]['style'] = array(); // reset style attribute array
+- while (list($id, $name) = each($style_array[1])) {
+- // in case of duplicate attribute the last replace the previous
+- $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
+- }
++ foreach($style_array[1] as $id => $name) {
++ // in case of duplicate attribute the last replace the previous
++ $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
++ }
+ // --- get some style attributes ---
+ // text direction
+ if (isset($dom[$key]['style']['direction'])) {
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..beab509
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,40 @@
+{
+ "name": "tecnickcom/tcpdf",
+ "version": "6.2.12",
+ "homepage": "http://www.tcpdf.org/",
+ "type": "library",
+ "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+ "keywords": ["PDF","tcpdf","PDFD32000-2008","qrcode","datamatrix","pdf417","barcodes"],
+ "license": "LGPLv3",
+ "authors": [
+ {
+ "name": "Nicola Asuni",
+ "email": "info@tecnick.com",
+ "homepage": "http://nicolaasuni.tecnick.com"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "classmap": [
+ "fonts",
+ "config",
+ "include",
+ "tcpdf.php",
+ "tcpdf_parser.php",
+ "tcpdf_import.php",
+ "tcpdf_barcodes_1d.php",
+ "tcpdf_barcodes_2d.php",
+ "include/tcpdf_colors.php",
+ "include/tcpdf_filters.php",
+ "include/tcpdf_font_data.php",
+ "include/tcpdf_fonts.php",
+ "include/tcpdf_images.php",
+ "include/tcpdf_static.php",
+ "include/barcodes/datamatrix.php",
+ "include/barcodes/pdf417.php",
+ "include/barcodes/qrcode.php"
+ ]
+ }
+}
diff --git a/php-tcpdf.spec b/php-tcpdf.spec
index a1da136..bcd0898 100644
--- a/php-tcpdf.spec
+++ b/php-tcpdf.spec
@@ -16,13 +16,17 @@
Name: php-tcpdf
Summary: PHP class for generating PDF documents and barcodes
Version: 6.2.13
-Release: 1%{?dist}
+Release: 4%{?dist}
URL: http://www.tcpdf.org
License: LGPLv3+
Group: Development/Libraries
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{?gh_short}.tar.gz
+# Disable opcache cahing for font metadata which may consume up to 90MB
+Source1: %{name}.blacklist
+
+Patch0: https://patch-diff.githubusercontent.com/raw/tecnickcom/TCPDF/pull/74.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -217,6 +221,7 @@ This package allow to use system GNU FreeFont serif font faces in TCPDF.
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1
: remove bundled fonts
rm -rf fonts/dejavu-fonts-ttf* fonts/freefont-* fonts/ae_fonts_*
@@ -254,6 +259,9 @@ install -d %{buildroot}%{_sysconfdir}/%{name}
install -m 0644 config/*.php \
%{buildroot}%{_sysconfdir}/%{name}
+install -Dpm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/php.d/opcache-%{name}.blacklist
+install -Dpm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/php-zts.d/opcache-%{name}.blacklist
+
: Tools
install -d %{buildroot}%{_bindir}
install -m 0755 tools/%{real_name}_addfont.php \
@@ -304,6 +312,8 @@ rm -rf %{buildroot}
%{_datadir}/php/%{real_name}/*php
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/*
+%config(noreplace) %{_sysconfdir}/php.d/opcache-%{name}.blacklist
+%config(noreplace) %{_sysconfdir}/php-zts.d/opcache-%{name}.blacklist
%files dejavu-lgc-sans-fonts
%defattr(-,root,root,-)
@@ -345,6 +355,11 @@ rm -rf %{buildroot}
%changelog
+* Thu Dec 21 2017 Remi Collet <remi@fedoraproject.org> - 6.2.13-4
+- add patch for PHP 7.2 from
+ https://github.com/tecnickcom/TCPDF/pull/74/files
+- disable opcache caching for fonts
+
* Mon Jan 9 2017 Remi Collet <remi@fedoraproject.org> - 6.2.13-1
- update to 6.2.13
- add classmap autoloader using fedora/autoloader