MDL-60237 libraries: TCPDF apply patch for PHP7.2

This commit is contained in:
Marina Glancy 2017-10-02 13:58:15 +08:00
parent cbc8560718
commit 906e3fcf6e
2 changed files with 6 additions and 3 deletions

View File

@ -5,12 +5,15 @@ Description of TCPDF library import 6.2.13
* remove tcpdf_import.php from composer.json * remove tcpdf_import.php from composer.json
* remove all fonts that were not already present * remove all fonts that were not already present
* visit http://127.0.0.1/lib/tests/other/pdflibtestpage.php and view the pdf * visit http://127.0.0.1/lib/tests/other/pdflibtestpage.php and view the pdf
* check the status of https://github.com/tecnickcom/TCPDF/pull/74 and re-apply if not merged/closed
2017/10/02 2017/10/02
---------- ----------
Upgrade to tcpdf_php5 TCPDF 6.2.13 (MDL-60237) Upgrade to tcpdf_php5 TCPDF 6.2.13 (MDL-60237)
by Marina Glancy <marina@moodle.com> by Marina Glancy <marina@moodle.com>
* replaced the calls to function each() deprecated in PHP7.2
2015/09/29 2015/09/29
---------- ----------
Upgrade to tcpdf_php5 TCPDF 6.2.12 (MDL-51534) Upgrade to tcpdf_php5 TCPDF 6.2.12 (MDL-51534)

View File

@ -12582,7 +12582,7 @@ class TCPDF {
$k = $this->k; $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 .= 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"; $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) { if (strcmp(substr($key, -5), 'Color') == 0) {
$val = TCPDF_COLORS::_JScolor($val); $val = TCPDF_COLORS::_JScolor($val);
} else { } else {
@ -16545,7 +16545,7 @@ class TCPDF {
// get attributes // get attributes
preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER); preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
$dom[$key]['attribute'] = array(); // reset attribute array $dom[$key]['attribute'] = array(); // reset attribute array
while (list($id, $name) = each($attr_array[1])) { foreach ($attr_array[1] as $id => $name) {
$dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
} }
if (!empty($css)) { if (!empty($css)) {
@ -16558,7 +16558,7 @@ class TCPDF {
// get style attributes // get style attributes
preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER); preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
$dom[$key]['style'] = array(); // reset style attribute array $dom[$key]['style'] = array(); // reset style attribute array
while (list($id, $name) = each($style_array[1])) { foreach ($style_array[1] as $id => $name) {
// in case of duplicate attribute the last replace the previous // in case of duplicate attribute the last replace the previous
$dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
} }