Introduce a binary-safe wrapper for strlen() and use it in seems_utf8(), utf8_uri_encode(), and wp_read_image_metadata().

Use binary-safe POMO_Reader::strlen() in MO::export_to_file_handle().

fixes #28162.

git-svn-id: https://develop.svn.wordpress.org/trunk@28806 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2014-06-23 14:47:08 +00:00
parent b11b6f2f2b
commit 4fd715c937
4 changed files with 27 additions and 7 deletions
+2 -2
View File
@@ -290,7 +290,7 @@ function wp_read_image_metadata( $file ) {
$caption = trim( $iptc['2#120'][0] );
if ( empty( $meta['title'] ) ) {
// Assume the title is stored in 2:120 if it's short.
if ( strlen( $caption ) < 80 )
if ( mbstring_binary_safe_strlen( $caption ) < 80 )
$meta['title'] = $caption;
else
$meta['caption'] = $caption;
@@ -327,7 +327,7 @@ function wp_read_image_metadata( $file ) {
}
if ( ! empty( $exif['ImageDescription'] ) ) {
if ( empty( $meta['title'] ) && strlen( $exif['ImageDescription'] ) < 80 ) {
if ( empty( $meta['title'] ) && mbstring_binary_safe_strlen( $exif['ImageDescription'] ) < 80 ) {
// Assume the title is stored in ImageDescription
$meta['title'] = trim( $exif['ImageDescription'] );
if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) {