diff --git a/tcpdf.php b/tcpdf.php index 7d967234..7db85623 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -5562,7 +5562,9 @@ protected function getCellCode($w, $h=0, $txt='', $border=0, $ln=0, $align='', $ // x space to skip if ($spacewidth != 0) { // justification shift - $xshift += (count(array_keys($uniarr, 32)) * $spw); + $xshift += (count(array_keys(array_filter($uniarr, function ($element) { + return $element == 32; + }))) * $spw); } $xshift += $this->GetArrStringWidth($uniarr); // + shift justification } else { diff --git a/tcpdf_barcodes_1d.php b/tcpdf_barcodes_1d.php index 45d35616..b1fdf1f1 100644 --- a/tcpdf_barcodes_1d.php +++ b/tcpdf_barcodes_1d.php @@ -543,7 +543,9 @@ protected function checksum_code39($code) { $sum = 0; $clen = strlen($code); for ($i = 0 ; $i < $clen; ++$i) { - $k = array_keys($chars, $code[$i]); + $k = array_keys(array_filter($chars, function ($value) use ($code, $i) { + return $value == $code[$i]; + })); $sum += $k[0]; } $j = ($sum % 43); @@ -699,7 +701,9 @@ protected function checksum_code93($code) { $p = 1; $check = 0; for ($i = ($len - 1); $i >= 0; --$i) { - $k = array_keys($chars, $code[$i]); + $k = array_keys(array_filter($chars, function ($value) use ($code, $i) { + return $value == $code[$i]; + })); $check += ($k[0] * $p); ++$p; if ($p > 20) { @@ -713,7 +717,9 @@ protected function checksum_code93($code) { $p = 1; $check = 0; for ($i = $len; $i >= 0; --$i) { - $k = array_keys($chars, $code[$i]); + $k = array_keys(array_filter($chars, function ($value) use ($code, $i) { + return $value == $code[$i]; + })); $check += ($k[0] * $p); ++$p; if ($p > 15) { @@ -1760,9 +1766,8 @@ protected function barcode_rms4cc($code, $kix=false) { } $row %= 6; $col %= 6; - $chk = array_keys($checktable, array($row,$col)); - $code .= $chk[0]; - ++$len; + $code .= array_search(array($row, $col), $checktable); + ++$len; } $k = 0; if ($notkix) {