Skip to content

Commit 1053586

Browse files
author
Jan Schneider
committed
[jan] Fix deprecation warnings about each() with PHP 7.2+.
1 parent dc7ea28 commit 1053586

File tree

7 files changed

+10
-14
lines changed

7 files changed

+10
-14
lines changed

docs/changelog.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@
7171
license:
7272
identifier: GPL-2.0
7373
uri: http://www.horde.org/licenses/gpl
74-
notes: |+
75-
74+
notes: |
75+
[jan] Fix deprecation warnings about each() with PHP 7.2+.
76+
|+
7677
6.2.27:
7778
api: 6.2.0
7879
state:

lib/Ajax/Application/ListMessages.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,7 @@ private function _getOverviewData($mbox, $msglist)
434434
));
435435

436436
/* Display message information. */
437-
reset($overview['overview']);
438-
while (list(,$ob) = each($overview['overview'])) {
437+
foreach ($overview['overview'] as $ob) {
439438
/* Get all the flag information. */
440439
$msg = array(
441440
'flag' => $flags

lib/Basic/Mailbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ protected function _init()
843843
$search_view = clone $view;
844844
$summary_view = clone $view;
845845

846-
while (list(,$ob) = each($mbox_info['overview'])) {
846+
foreach ($mbox_info['overview'] as $ob) {
847847
if ($search_mbox) {
848848
if (empty($lastMbox) || ($ob['mailbox'] != $lastMbox)) {
849849
if (!empty($lastMbox)) {

lib/Contents.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,7 @@ public function getInlineOutput(array $options = array())
14801480
continue;
14811481
}
14821482

1483-
reset($render_part);
1484-
while (list($id, $info) = each($render_part)) {
1483+
foreach ($render_part as $id => $info) {
14851484
$display_ids[$id] = 1;
14861485

14871486
if (empty($info)) {
@@ -1534,8 +1533,7 @@ public function getInlineOutput(array $options = array())
15341533
uksort($msgtext, 'strnatcmp');
15351534
}
15361535

1537-
reset($msgtext);
1538-
while (list($id, $part) = each($msgtext)) {
1536+
foreach ($msgtext as $id => $part) {
15391537
while (!empty($wrap_ids) &&
15401538
!Horde_Mime::isChild(end($wrap_ids), $id)) {
15411539
array_pop($wrap_ids);

lib/Mailbox/List/Virtual.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ public function getIndicesOb()
9494
$this->_buildMailbox();
9595
$ob = new IMP_Indices();
9696

97-
reset($this->_sorted);
98-
while (list($k, $v) = each($this->_sorted)) {
97+
foreach ($this->_sorted as $k => $v) {
9998
$ob->add($this->_sortedMbox[$k], $v);
10099
}
101100

lib/Mime/Viewer/Plain.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,7 @@ protected function _parseUUencode()
277277
$text_part->setContents(preg_replace("/begin [0-7]{3} .+\r?\n.+\r?\nend/Us", "\n", $text));
278278
$new_part->addPart($text_part);
279279

280-
reset($files);
281-
while (list(,$file) = each($files)) {
280+
foreach ($files as $file) {
282281
$uupart = new Horde_Mime_Part();
283282
$uupart->setType('application/octet-stream');
284283
$uupart->setContents($file['data']);

lib/Minimal/Mailbox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function _init()
123123
$mbox_info = $imp_mailbox->getMailboxArray(range($pageOb['begin'], $pageOb['end']), array('headers' => true));
124124
$msgs = array();
125125

126-
while (list(,$ob) = each($mbox_info['overview'])) {
126+
foreach ($mbox_info['overview'] as $ob) {
127127
/* Initialize the header fields. */
128128
$msg = array(
129129
'buid' => $imp_mailbox->getBuid($ob['mailbox'], $ob['uid']),

0 commit comments

Comments
 (0)