From 7caac9ebe726017c424a8826db53e0e308eb8dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 3 Nov 2020 21:35:23 +0100 Subject: [PATCH] The function each() has been deprecated: 7.2 --- htdocs/core/lib/barcode.lib.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index 7f30e9d83f2..0447927ec4d 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -373,11 +373,8 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, } $chars = explode(" ", $text); - reset($chars); - while (list($n, $v) = each($chars)) - { - if (trim($v)) - { + foreach ($chars as $v) { + if (trim($v)) { $inf = explode(":", $v); $fontsize = $scale * ($inf[1] / 1.8); $fontheight = $total_y - ($fontsize / 2.7) + 2; @@ -387,16 +384,14 @@ function barcode_outimage($text, $bars, $scale = 1, $mode = "png", $total_y = 0, /* output the image */ $mode = strtolower($mode); - if ($mode == 'jpg' || $mode == 'jpeg') - { + if ($mode == 'jpg' || $mode == 'jpeg') { header("Content-Type: image/jpeg; name=\"barcode.jpg\""); imagejpeg($im); - } elseif ($mode == 'gif') - { + } elseif ($mode == 'gif') { header("Content-Type: image/gif; name=\"barcode.gif\""); imagegif($im); - } elseif (!empty($filebarcode)) // To wxrite into afile onto disk - { + } elseif (!empty($filebarcode)) { + // To wxrite into afile onto disk imagepng($im, $filebarcode); } else { header("Content-Type: image/png; name=\"barcode.png\"");