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
+18
View File
@@ -4404,6 +4404,24 @@ function reset_mbstring_encoding() {
mbstring_binary_safe_encoding( true );
}
/**
* Uses a binary-safe encoding to get the length of a string in bytes if func_overload is enabled.
*
* @see mbstring_binary_safe_encoding()
*
* @since 4.0.0
*
* @param string $string The string to get the length of.
* @return int The length of the string in bytes.
*/
function mbstring_binary_safe_strlen( $string ) {
mbstring_binary_safe_encoding();
$length = strlen( $string );
reset_mbstring_encoding();
return $length;
}
/**
* Alternative to filter_var( $var, FILTER_VALIDATE_BOOLEAN )
*