Ticket #28162: 28162.6.patch
File 28162.6.patch, 3.8 KB (added by , 10 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
481 481 * @return bool True if $str fits a UTF-8 model, false otherwise. 482 482 */ 483 483 function seems_utf8($str) { 484 $length = strlen($str);484 $length = mbstring_binary_safe_strlen($str); 485 485 for ($i=0; $i < $length; $i++) { 486 486 $c = ord($str[$i]); 487 487 if ($c < 0x80) $n = 0; # 0bbbbbbb … … 705 705 $num_octets = 1; 706 706 $unicode_length = 0; 707 707 708 $string_length = strlen( $utf8_string );708 $string_length = mbstring_binary_safe_strlen( $utf8_string ); 709 709 for ($i = 0; $i < $string_length; $i++ ) { 710 710 711 711 $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.0 4413 * 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 /** 4408 4426 * Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN ) 4409 4427 * 4410 4428 * @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 }