mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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:
@@ -481,7 +481,7 @@ function shortcode_unautop( $pee ) {
|
||||
* @return bool True if $str fits a UTF-8 model, false otherwise.
|
||||
*/
|
||||
function seems_utf8($str) {
|
||||
$length = strlen($str);
|
||||
$length = mbstring_binary_safe_strlen($str);
|
||||
for ($i=0; $i < $length; $i++) {
|
||||
$c = ord($str[$i]);
|
||||
if ($c < 0x80) $n = 0; # 0bbbbbbb
|
||||
@@ -705,7 +705,7 @@ function utf8_uri_encode( $utf8_string, $length = 0 ) {
|
||||
$num_octets = 1;
|
||||
$unicode_length = 0;
|
||||
|
||||
$string_length = strlen( $utf8_string );
|
||||
$string_length = mbstring_binary_safe_strlen( $utf8_string );
|
||||
for ($i = 0; $i < $string_length; $i++ ) {
|
||||
|
||||
$value = ord( $utf8_string[ $i ] );
|
||||
|
||||
Reference in New Issue
Block a user