Make WordPress Core

Ticket #18007: 18007.5.alt.patch

File 18007.5.alt.patch, 921 bytes (added by SergeyBiryukov, 12 years ago)
  • wp-includes/functions.php

     
    251251        $data = trim( $data );
    252252        if ( 'N;' == $data )
    253253                return true;
    254         $length = strlen( $data );
     254        // if mbstring.func_overload is enabled, strlen() may not return the full length in bytes for UTF-8 strings
     255        $length = 0;
     256        while ( isset( $data[ $length ] ) )
     257                $length++;
    255258        if ( $length < 4 )
    256259                return false;
    257260        if ( ':' !== $data[1] )
     
    288291        if ( !is_string( $data ) )
    289292                return false;
    290293        $data = trim( $data );
    291         $length = strlen( $data );
     294        // if mbstring.func_overload is enabled, strlen() may not return the full length in bytes for UTF-8 strings
     295        $length = 0;
     296        while ( isset( $data[ $length ] ) )
     297                $length++;
    292298        if ( $length < 4 )
    293299                return false;
    294300        elseif ( ':' !== $data[1] )