MDL-60237 libraries: TCPDF apply patch for PHP7.2
authorMarina Glancy <marina@moodle.com>
Mon, 2 Oct 2017 05:58:15 +0000 (13:58 +0800)
committerMarina Glancy <marina@moodle.com>
Mon, 9 Oct 2017 02:02:56 +0000 (10:02 +0800)
lib/tcpdf/readme_moodle.txt
lib/tcpdf/tcpdf.php

index 39385d6..12b9af9 100644 (file)
@@ -5,12 +5,15 @@ Description of TCPDF library import 6.2.13
 * remove tcpdf_import.php from composer.json
 * remove all fonts that were not already present
 * 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
 ----------
 Upgrade to tcpdf_php5 TCPDF 6.2.13 (MDL-60237)
 by Marina Glancy <marina@moodle.com>
 
+* replaced the calls to function each() deprecated in PHP7.2
+
 2015/09/29
 ----------
 Upgrade to tcpdf_php5 TCPDF 6.2.12 (MDL-51534)
index 65196e7..5a6a8c3 100644 (file)
@@ -12582,7 +12582,7 @@ class TCPDF {
                $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,7 +16545,7 @@ class TCPDF {
                                        // 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])) {
+                                       foreach ($attr_array[1] as $id => $name) {
                                                $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
                                        }
                                        if (!empty($css)) {
@@ -16558,7 +16558,7 @@ class TCPDF {
                                                // 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])) {
+                                               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]);
                                                }