From c399654df66a7c3f91eb652aaaa0ad36adc7302d Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 17 Jan 2024 14:30:47 +0000 Subject: [PATCH] I18N: Prevent PHP warning in `WP_Textdomain_Registry`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents a warning upon cache invalidation after language pack updates if the arguments don’t have the expected format. Follow-up to [57287], [57290], [57298], [57299]. See #58919. git-svn-id: https://develop.svn.wordpress.org/trunk@57303 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-textdomain-registry.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-textdomain-registry.php b/src/wp-includes/class-wp-textdomain-registry.php index 8ff8ad0ae2..54f5f15c4d 100644 --- a/src/wp-includes/class-wp-textdomain-registry.php +++ b/src/wp-includes/class-wp-textdomain-registry.php @@ -228,7 +228,11 @@ class WP_Textdomain_Registry { * @return void */ public function invalidate_mo_files_cache( $upgrader, $hook_extra ) { - if ( 'translation' !== $hook_extra['type'] || array() === $hook_extra['translations'] ) { + if ( + ! isset( $hook_extra['type'] ) || + 'translation' !== $hook_extra['type'] || + array() === $hook_extra['translations'] + ) { return; }