Commit 27fde08bdf for wordpress.org
commit 27fde08bdfa2bf576b118173c6b391d216c8d3f9
Author: audrasjb <audrasjb@git.wordpress.org>
Date: Tue Nov 17 11:18:12 2026 +0000
Media: Ignore bare EXIF `UserComment` character codes.
After `trim()`, the `UserComment` is now discarded when it is exactly one of the character codes `ASCII`, `UNICODE`, or `JIS`. A bare code holds no comment, so the metadata falls back to `ImageDescription` (or to nothing). Valid comments, including ones that contain a code word as part of a longer string, are unchanged.
Developed in https://github.com/WordPress/wordpress-develop/pull/15434.
Props lessbloat, sarequl, matt, azaozz.
Fixes #66462.
Built from https://develop.svn.wordpress.org/trunk@65550
git-svn-id: http://core.svn.wordpress.org/trunk@64623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php
index a05531c6d9..d4b40afc7b 100644
--- a/wp-admin/includes/image.php
+++ b/wp-admin/includes/image.php
@@ -964,6 +964,14 @@ function wp_read_image_metadata( $file ) {
if ( ! empty( $exif['COMPUTED']['UserComment'] ) ) {
$exif_usercomment = trim( $exif['COMPUTED']['UserComment'] );
+
+ /*
+ * PHP returns a UserComment shorter than its 8-byte character code
+ * as the bare code, such as "ASCII". It holds no comment.
+ */
+ if ( in_array( $exif_usercomment, array( 'ASCII', 'UNICODE', 'JIS' ), true ) ) {
+ $exif_usercomment = '';
+ }
}
if ( $exif_description ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e729429260..288b604d4d 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-beta5-65549';
+$wp_version = '7.2-beta5-65550';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.