Commit:    190459c76656a9e9e79b7a2b588bc49f6cbf4013
Author:    Peter Kokot <peterko...@gmail.com>         Sun, 4 Nov 2018 02:03:56 
+0100
Parents:   b7231b60cdd3d1bbf03621216b889d19995756a4
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=190459c76656a9e9e79b7a2b588bc49f6cbf4013

Log:
Refactor each() function to foreach()

The each() function has been deprecated since PHP 7.2 and shouldn't be
used anymore:
- http://php.net/manual/en/function.each.php

Changed paths:
  M  bin/bumpRelease
  M  include/check_email_func.php
  M  mailing-lists.php
  M  mirror.php
  M  releases/index.php
  M  ug.php


Diff:
diff --git a/bin/bumpRelease b/bin/bumpRelease
index a4d383d..4c50291 100755
--- a/bin/bumpRelease
+++ b/bin/bumpRelease
@@ -21,7 +21,8 @@ if (isset($_SERVER['argv'][2])) {
        $info = $RELEASES[$major][$version];
 } else {
        // Calling without a minor will just grab the most recent minor.
-       list($version, $info) = each($RELEASES[$major]);
+       $version = key($RELEASES[$major]);
+       $info = current($RELEASES[$major]);
 }
 
 $info["date"] = ${"PHP_{$major}_DATE"};
diff --git a/include/check_email_func.php b/include/check_email_func.php
index ea1c096..8f617f3 100644
--- a/include/check_email_func.php
+++ b/include/check_email_func.php
@@ -13,7 +13,7 @@ $test_add = array (
     "asasasd324...@php.net", "jcastagnetto-delete-th...@yahoo.com",
     "wrong-address-with@@@@-remove_me-and-some-i-hate_SPAM-stuff");
 
-while (list(,$v) = each($test_add)) {
+foreach ($test_add as $v) {
     echo "The address: $v (".clean_AntiSpam($v).") is";
     if (!is_emailable_address(clean_AntiSPAM($v)))
         echo " not";
diff --git a/mailing-lists.php b/mailing-lists.php
index e0edbb5..5b94415 100644
--- a/mailing-lists.php
+++ b/mailing-lists.php
@@ -302,7 +302,7 @@ if (isset($_POST['maillist'])) {
 function output_lists_table($mailing_lists)
 {
     echo '<table cellpadding="5" border="0" class="standard mailing-lists">', 
"\n";
-    while ( list(, $listinfo) = each($mailing_lists)) {
+    foreach ($mailing_lists as $listinfo) {
         if (!is_array($listinfo)) {
             echo "<tr><th>{$listinfo}</th><th>Moderated</th><th>Archive</th>" .
                  "<th>Newsgroup</th><th>Normal</th><th>Digest</th></tr>\n";
diff --git a/mirror.php b/mirror.php
index 5ab28a2..00e526b 100644
--- a/mirror.php
+++ b/mirror.php
@@ -23,8 +23,7 @@ if (is_official_mirror()) {
 
     // Iterate through possible mirror provider logo types in priority order
     $types = array("gif", "jpg", "png");
-    while (list(,$ext) = each($types)) {
-
+    foreach ($types as $ext) {
         // Check if file exists for this type
         if (file_exists("backend/mirror." . $ext)) {
 
diff --git a/releases/index.php b/releases/index.php
index bb4531d..de4bf86 100644
--- a/releases/index.php
+++ b/releases/index.php
@@ -52,7 +52,8 @@ if (isset($_GET["serialize"]) || isset($_GET["json"])) {
                }
        } else {
                foreach($RELEASES as $major => $release) {
-                       list($version, $r) = each($release);
+                       $version = key($release);
+                       $r = current($release);
                        $r["version"] = $version;
                        $machineReadable[$major] = $r;
                }
diff --git a/ug.php b/ug.php
index 02345ac..53efd11 100644
--- a/ug.php
+++ b/ug.php
@@ -42,7 +42,11 @@ function ug_get_next_even_from_ical_array($ical) {
     $data = array();
     foreach($ical as $line) {
         if ($line == "BEGIN:VEVENT") {
-            do {
+            foreach ($ical as $n => $line) {
+                if ("END:VEVENT" == $line) {
+                    break;
+                }
+
                 if ($line[0] == " ") {
                     // data continued from previous key
                     $data[$lastkey] .= ltrim($line);
@@ -50,7 +54,8 @@ function ug_get_next_even_from_ical_array($ical) {
                     list($lastkey, $value) = explode(":", $line, 2);
                     $data[$lastkey] = $value;
                 }
-            } while((list($n, $line) = each($ical)) && $line != "END:VEVENT");
+            }
+
             break;
         }
     }


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to