summaryrefslogtreecommitdiffstats
path: root/dc2e8561c551644ae6ccd07739994d905de206c2.patch
blob: d875b0fd3536be456635a30e1175575f370989e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From dc2e8561c551644ae6ccd07739994d905de206c2 Mon Sep 17 00:00:00 2001
From: Jan Schneider <jan@horde.org>
Date: Mon, 13 Feb 2017 14:57:35 +0100
Subject: [PATCH] Don't use each().

For modern PHP versions there is no improved performance or memory usage compared to foreach() anymore. Beside that it's deprecated in PHP 7.2.
---
 lib/Horde/LoginTasks/Tasklist.php | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Horde/LoginTasks/Tasklist.php b/lib/Horde/LoginTasks/Tasklist.php
index 0812630..6346ede 100644
--- a/lib/Horde/LoginTasks/Tasklist.php
+++ b/lib/Horde/LoginTasks/Tasklist.php
@@ -99,8 +99,7 @@ public function ready($advance = false)
             }
         }
 
-        reset($this->_tasks);
-        while (list($k, $v) = each($this->_tasks)) {
+        foreach ($this->_tasks as $k => $v) {
             if ($v->needsDisplay() && ($k >= $this->_ptr)) {
                 break;
             }
@@ -127,8 +126,7 @@ public function needDisplay($advance = false)
         $tmp = array();
         $previous = null;
 
-        reset($this->_tasks);
-        while (list(, $v) = each($this->_tasks)) {
+        foreach ($this->_tasks as $v) {
             if (!$v->needsDisplay() ||
                 (!is_null($previous) && !$v->joinDisplayWith($previous))) {
                 break;