com web/master: Refactor each() function to foreach(): include/login.inc scripts/rss_parser

From: Date: Fri, 07 Dec 2018 12:24:23 +0000
Subject: com web/master: Refactor each() function to foreach(): include/login.inc scripts/rss_parser
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-27512@lists.php.net to get a copy of this message
Commit: bce0f6fa023edad1b61285bea51b554a00ab488b Author: Peter Kokot <peterkokot@gmail.com> Fri, 7 Dec 2018 13:24:23 +0100 Parents: 79586cd22edce0fbe4397102574c6e881dba2f10 Branches: master Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=bce0f6fa023edad1b61285bea51b554a00ab488b 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 include/login.inc M scripts/rss_parser Diff: diff --git a/include/login.inc b/include/login.inc index 1eccc52..94d0bb7 100644 --- a/include/login.inc +++ b/include/login.inc @@ -116,7 +116,7 @@ function query_string() function preserve_form_fields() { if (isset($_POST['in']) && is_array($_POST['in'])) { - while (list($k, $v) = each($_POST['in'])) { + foreach ($_POST['in'] as $k => $v) { echo "<input type=\"hidden\" name=\"in[", hsc($k), "]\" value=\"", hsc($v), "\" />\n"; } diff --git a/scripts/rss_parser b/scripts/rss_parser index 8b80abe..34b5b3f 100644 --- a/scripts/rss_parser +++ b/scripts/rss_parser @@ -87,7 +87,7 @@ function ParseNews ($index_page = "", $aboutLink) { // Try to classify every line backed with state information // and patterns to recognize for news item elements - while (list($i, $line) = each($lines)) { + foreach ($lines as $i => $line) { // We are not in a news item if (!$news_started) {

« previous php.webmaster (#27512) next »