WordPress.org

Make WordPress Core

Ticket #43224: 43224.patch

File 43224.patch, 1.1 KB (added by jaswrks, 4 years ago)
  • src/wp-includes/formatting.php

     
    10941094}
    10951095
    10961096/**
     1097 * Checks support for utf8 in the installed PCRE library.
     1098 *
     1099 * @since 5.0.0
     1100 *
     1101 * @staticvar bool $can
     1102 *
     1103 * @return bool True if installed PCRE library supports the `/u` flag.
     1104 */
     1105function wp_can_utf8_pcre() {
     1106        static $can = null;
     1107
     1108        if ( ! isset( $can ) ) {
     1109                $can = (bool) @preg_match( '/^./u', 'a' );
     1110        }
     1111
     1112        return $can;
     1113}
     1114
     1115/**
    10971116 * Checks for invalid UTF8 in a string.
    10981117 *
    10991118 * @since 2.8.0
     
    11211140                return $string;
    11221141        }
    11231142
    1124         // Check for support for utf8 in the installed PCRE library once and store the result in a static
    1125         static $utf8_pcre = null;
    1126         if ( ! isset( $utf8_pcre ) ) {
    1127                 $utf8_pcre = @preg_match( '/^./u', 'a' );
    1128         }
    11291143        // We can't demand utf8 in the PCRE installation, so just return the string in those cases
    1130         if ( ! $utf8_pcre ) {
     1144        if ( ! wp_can_utf8_pcre() ) {
    11311145                return $string;
    11321146        }
    11331147