WordPress.org

Make WordPress Core

Ticket #21566: 21566.patch

File 21566.patch, 1.2 KB (added by bpetty, 3 years ago)
  • wp-includes/compat.php

    diff --git wp-includes/compat.php wp-includes/compat.php
    index cb2a559..7d99d20 100644
    if ( !function_exists('_') ) { 
    1313        } 
    1414} 
    1515 
    16 if ( !function_exists('mb_substr') ): 
    17         function mb_substr( $str, $start, $length=null, $encoding=null ) { 
    18                 return _mb_substr($str, $start, $length, $encoding); 
    19         } 
    20 endif; 
    21  
    22 function _mb_substr( $str, $start, $length=null, $encoding=null ) { 
    23         // the solution below, works only for utf-8, so in case of a different 
    24         // charset, just use built-in substr 
    25         $charset = get_option( 'blog_charset' ); 
    26         if ( !in_array( $charset, array('utf8', 'utf-8', 'UTF8', 'UTF-8') ) ) { 
    27                 return is_null( $length )? substr( $str, $start ) : substr( $str, $start, $length); 
    28         } 
    29         // use the regex unicode support to separate the UTF-8 characters into an array 
    30         preg_match_all( '/./us', $str, $match ); 
    31         $chars = is_null( $length )? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length ); 
    32         return implode( '', $chars ); 
    33 } 
    34  
    3516if ( !function_exists('hash_hmac') ): 
    3617function hash_hmac($algo, $data, $key, $raw_output = false) { 
    3718        return _hash_hmac($algo, $data, $key, $raw_output);