From c2a699cee8a14830a2b63ccacf6306e5863dba5f Mon Sep 17 00:00:00 2001 From: Huzaifa Al Mesbah Date: Sun, 4 Oct 2026 21:18:36 +0600 Subject: [PATCH] Media: Remove redundant array_values call on IPTC keywords in wp_read_image_metadata. In [34374] when IPTC keywords parsing was added, array_values() was called on $iptc['2#025']. In PHP, iptcparse() returns IPTC tags as sequential zero-indexed arrays, so calling array_values() has no effect and surfaces an arrayValues.list PHPStan error. This was the sole occurrence, so the change empties and retires tests/phpstan/baselines/arrayValues.list.neon. See #65817. --- phpstan.neon.dist | 1 - src/wp-admin/includes/image.php | 2 +- tests/phpstan/baselines/arrayValues.list.neon | 25 ------------------- 3 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 tests/phpstan/baselines/arrayValues.list.neon diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 09987c1c557fb..5e64b34bab45c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -24,7 +24,6 @@ includes: # phpstan:baselines start - tests/phpstan/baselines/argument.type.neon - tests/phpstan/baselines/argument.unresolvableType.neon - - tests/phpstan/baselines/arrayValues.list.neon - tests/phpstan/baselines/assign.propertyType.neon - tests/phpstan/baselines/binaryOp.invalid.neon - tests/phpstan/baselines/booleanAnd.alwaysFalse.neon diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php index c3a4a8d769be0..9ef28890e4818 100644 --- a/src/wp-admin/includes/image.php +++ b/src/wp-admin/includes/image.php @@ -922,7 +922,7 @@ function wp_read_image_metadata( $file ) { } if ( ! empty( $iptc['2#025'][0] ) ) { // Keywords array. - $meta['keywords'] = array_values( $iptc['2#025'] ); + $meta['keywords'] = $iptc['2#025']; } } } diff --git a/tests/phpstan/baselines/arrayValues.list.neon b/tests/phpstan/baselines/arrayValues.list.neon deleted file mode 100644 index 630c8e6bd1879..0000000000000 --- a/tests/phpstan/baselines/arrayValues.list.neon +++ /dev/null @@ -1,25 +0,0 @@ -# PHPStan baseline for the `arrayValues.list` errors in WordPress core. -# -# https://phpstan.org/error-identifiers/arrayValues.list -# -# Each entry is scoped to a single file and carries an exact occurrence count, -# so that a new instance is reported as a new error rather than being absorbed -# silently. Fixing an occurrence therefore means decrementing or removing its -# entry here as part of the same change. -# -# The goal is to empty this file and delete it, along with the `includes` entry -# for it in phpstan.neon.dist. -# -# Generated by `composer phpstan:baselines`. Do not edit by hand; regenerate with -# -# composer phpstan:baselines -- --identifier=arrayValues.list -# -# which reruns the analysis with this file suppressed so the errors surface again. - -parameters: - ignoreErrors: - - - message: '#^Parameter \#1 \$array \(non\-empty\-list\\) of array_values is already a list, call has no effect\.$#' - identifier: arrayValues.list - count: 1 - path: ../../../src/wp-admin/includes/image.php