Ticket #28162: 28162.7.patch
File 28162.7.patch, 3.1 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/image.php
289 289 if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption 290 290 $caption = trim( $iptc['2#120'][0] ); 291 291 if ( empty( $meta['title'] ) ) { 292 mbstring_binary_safe_encoding(); 293 $caption_length = strlen( $caption ); 294 reset_mbstring_encoding(); 295 292 296 // Assume the title is stored in 2:120 if it's short. 293 if ( mbstring_binary_safe_strlen( $caption ) < 80 )297 if ( $caption_length < 80 ) { 294 298 $meta['title'] = $caption; 295 else299 } else { 296 300 $meta['caption'] = $caption; 301 } 297 302 } elseif ( $caption != $meta['title'] ) { 298 303 $meta['caption'] = $caption; 299 304 } … … 327 332 } 328 333 329 334 if ( ! empty( $exif['ImageDescription'] ) ) { 330 if ( empty( $meta['title'] ) && mbstring_binary_safe_strlen( $exif['ImageDescription'] ) < 80 ) { 335 mbstring_binary_safe_encoding(); 336 $description_length = strlen( $exif['ImageDescription'] ); 337 reset_mbstring_encoding(); 338 339 if ( empty( $meta['title'] ) && $description_length < 80 ) { 331 340 // Assume the title is stored in ImageDescription 332 341 $meta['title'] = trim( $exif['ImageDescription'] ); 333 342 if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) { -
src/wp-includes/formatting.php
481 481 * @return bool True if $str fits a UTF-8 model, false otherwise. 482 482 */ 483 483 function seems_utf8($str) { 484 $length = mbstring_binary_safe_strlen($str); 484 mbstring_binary_safe_encoding(); 485 $length = strlen($str); 486 reset_mbstring_encoding(); 485 487 for ($i=0; $i < $length; $i++) { 486 488 $c = ord($str[$i]); 487 489 if ($c < 0x80) $n = 0; # 0bbbbbbb … … 705 707 $num_octets = 1; 706 708 $unicode_length = 0; 707 709 708 $string_length = mbstring_binary_safe_strlen( $utf8_string ); 710 mbstring_binary_safe_encoding(); 711 $string_length = strlen( $utf8_string ); 712 reset_mbstring_encoding(); 713 709 714 for ($i = 0; $i < $string_length; $i++ ) { 710 715 711 716 $value = ord( $utf8_string[ $i ] ); -
src/wp-includes/functions.php
4405 4405 } 4406 4406 4407 4407 /** 4408 * Uses a binary-safe encoding to get the length of a string in bytes if func_overload is enabled.4409 *4410 * @see mbstring_binary_safe_encoding()4411 *4412 * @since 4.0.04413 *4414 * @param string $string The string to get the length of.4415 * @return int The length of the string in bytes.4416 */4417 function mbstring_binary_safe_strlen( $string ) {4418 mbstring_binary_safe_encoding();4419 $length = strlen( $string );4420 reset_mbstring_encoding();4421 4422 return $length;4423 }4424 4425 /**4426 4408 * Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ) 4427 4409 * 4428 4410 * @since 4.0.0