Ticket #28162: 28162.5.patch
File 28162.5.patch, 3.7 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/image.php
290 290 $caption = trim( $iptc['2#120'][0] ); 291 291 if ( empty( $meta['title'] ) ) { 292 292 // Assume the title is stored in 2:120 if it's short. 293 if ( strlen( $caption ) < 80 )293 if ( mbstring_binary_safe_strlen( $caption ) < 80 ) 294 294 $meta['title'] = $caption; 295 295 else 296 296 $meta['caption'] = $caption; … … 327 327 } 328 328 329 329 if ( ! empty( $exif['ImageDescription'] ) ) { 330 if ( empty( $meta['title'] ) && strlen( $exif['ImageDescription'] ) < 80 ) {330 if ( empty( $meta['title'] ) && mbstring_binary_safe_strlen( $exif['ImageDescription'] ) < 80 ) { 331 331 // Assume the title is stored in ImageDescription 332 332 $meta['title'] = trim( $exif['ImageDescription'] ); 333 333 if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) && trim( $exif['COMPUTED']['UserComment'] ) != $meta['title'] ) { -
src/wp-includes/formatting.php
410 410 * @return bool True if $str fits a UTF-8 model, false otherwise. 411 411 */ 412 412 function seems_utf8($str) { 413 $length = strlen($str);413 $length = mbstring_binary_safe_strlen($str); 414 414 for ($i=0; $i < $length; $i++) { 415 415 $c = ord($str[$i]); 416 416 if ($c < 0x80) $n = 0; # 0bbbbbbb … … 634 634 $num_octets = 1; 635 635 $unicode_length = 0; 636 636 637 $string_length = strlen( $utf8_string );637 $string_length = mbstring_binary_safe_strlen( $utf8_string ); 638 638 for ($i = 0; $i < $string_length; $i++ ) { 639 639 640 640 $value = ord( $utf8_string[ $i ] ); -
src/wp-includes/functions.php
4437 4437 } 4438 4438 4439 4439 /** 4440 * Uses a binary-safe encoding to get string length in bytes if func_overload is enabled. 4441 * 4442 * @see mbstring_binary_safe_encoding() 4443 * 4444 * @since 4.0.0 4445 */ 4446 function mbstring_binary_safe_strlen( $string ) { 4447 mbstring_binary_safe_encoding(); 4448 $length = strlen( $string ); 4449 reset_mbstring_encoding(); 4450 4451 return $length; 4452 } 4453 4454 /** 4440 4455 * Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ) 4441 4456 * 4442 4457 * @since 4.0.0 -
src/wp-includes/pomo/mo.php
75 75 $current_addr++; 76 76 $originals_table = chr(0); 77 77 78 $reader = new POMO_Reader(); 79 78 80 foreach($entries as $entry) { 79 81 $originals_table .= $this->export_original($entry) . chr(0); 80 $length = strlen($this->export_original($entry));82 $length = $reader->strlen($this->export_original($entry)); 81 83 fwrite($fh, pack('VV', $length, $current_addr)); 82 84 $current_addr += $length + 1; // account for the NULL byte after 83 85 } 84 86 85 87 $exported_headers = $this->export_headers(); 86 fwrite($fh, pack('VV', strlen($exported_headers), $current_addr));88 fwrite($fh, pack('VV', $reader->strlen($exported_headers), $current_addr)); 87 89 $current_addr += strlen($exported_headers) + 1; 88 90 $translations_table = $exported_headers . chr(0); 89 91 90 92 foreach($entries as $entry) { 91 93 $translations_table .= $this->export_translations($entry) . chr(0); 92 $length = strlen($this->export_translations($entry));94 $length = $reader->strlen($this->export_translations($entry)); 93 95 fwrite($fh, pack('VV', $length, $current_addr)); 94 96 $current_addr += $length + 1; 95 97 }