From dd64c95f656de7b743038a967cade9091fd6d5c4 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Tue, 7 Jul 2020 20:36:41 +0000 Subject: [PATCH] Administration: Fix failing tests as a result of [48397]. Because of changes to how PHP handles arrays used in `foreach()` loops in PHP >= 7.0, [48397] resulted in a failing test for PHP 5.6. This calls `reset()` after using the `$results` array in the `foreach()` to ensure the array is treated the same and as expected. Props azaozz, desrosj, SergeyBiryukov, xknown. See #50448. git-svn-id: https://develop.svn.wordpress.org/trunk@48401 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-plugin-upgrader.php | 1 + src/wp-admin/includes/class-theme-upgrader.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/wp-admin/includes/class-plugin-upgrader.php b/src/wp-admin/includes/class-plugin-upgrader.php index 689206b637..cad0a613ac 100644 --- a/src/wp-admin/includes/class-plugin-upgrader.php +++ b/src/wp-admin/includes/class-plugin-upgrader.php @@ -392,6 +392,7 @@ class Plugin_Upgrader extends WP_Upgrader { unset( $past_failure_emails[ $plugin ] ); } update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + reset( $results ); return $results; } diff --git a/src/wp-admin/includes/class-theme-upgrader.php b/src/wp-admin/includes/class-theme-upgrader.php index 020c49469e..9dfb751d12 100644 --- a/src/wp-admin/includes/class-theme-upgrader.php +++ b/src/wp-admin/includes/class-theme-upgrader.php @@ -501,6 +501,7 @@ class Theme_Upgrader extends WP_Upgrader { unset( $past_failure_emails[ $theme ] ); } update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); + reset( $results ); return $results; }