mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-04 18:01:42 +01:00
Media: Ensure wp_read_image_metadata
filter returns array for $iptc
and $exif
.
Makes the behavior of the filter lines up with its documentation. Previously, both `$iptc` and `$exif` could return `false` when `exif_read_data()` or `iptcparse()` failed. Now, if those functions do not return an array, the results are explicitly set to `array()`. Props volodymyrkolesnykov, SergeyBiryukov, sabernhardt, sumitsingh, mikeschroder. Fixes #54637. Built from https://develop.svn.wordpress.org/trunk@53303 git-svn-id: http://core.svn.wordpress.org/trunk@52892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c6dbcf8576
commit
d9266d5bfd
@ -776,6 +776,10 @@ function wp_read_image_metadata( $file ) {
|
||||
$iptc = @iptcparse( $info['APP13'] );
|
||||
}
|
||||
|
||||
if ( ! is_array( $iptc ) ) {
|
||||
$iptc = array();
|
||||
}
|
||||
|
||||
// Headline, "A brief synopsis of the caption".
|
||||
if ( ! empty( $iptc['2#105'][0] ) ) {
|
||||
$meta['title'] = trim( $iptc['2#105'][0] );
|
||||
@ -845,6 +849,10 @@ function wp_read_image_metadata( $file ) {
|
||||
$exif = @exif_read_data( $file );
|
||||
}
|
||||
|
||||
if ( ! is_array( $exif ) ) {
|
||||
$exif = array();
|
||||
}
|
||||
|
||||
if ( ! empty( $exif['ImageDescription'] ) ) {
|
||||
mbstring_binary_safe_encoding();
|
||||
$description_length = strlen( $exif['ImageDescription'] );
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta3-53302';
|
||||
$wp_version = '6.0-beta3-53303';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user