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:
@@ -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 )
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user