[wp-trac] [WordPress Trac] #43224: Extract `$utf8_pcre` from `wp_check_invalid_utf8()` into a separate function

WordPress Trac noreply at wordpress.org
Sat Feb 3 23:59:26 UTC 2018


#43224: Extract `$utf8_pcre` from `wp_check_invalid_utf8()` into a separate
function
-------------------------+-----------------------------
 Reporter:  jaswrks      |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Formatting   |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 The `wp_check_invalid_utf8()` function checks to confirm support for the
 `/u` flag in regular expressions. The result of that check is cached in a
 static variable within that function. However, other areas of the codebase
 might want to run the same check, or maybe plugins would like to check
 also.

 I'm considering a change in Gutenberg's PEG parser and that might serve as
 an example use case for the new `wp_can_utf8_pcre()` function I'm
 proposing in this ticket. Instead of running the same check all over
 again, having this check run once by a utility function would be nice.

 See:
 https://github.com/WordPress/gutenberg/blob/daad3f21319ec9ec73fa1b907119a7464442bfac/lib/parser.php#L1818

--
Ticket URL: <https://core.trac.wordpress.org/ticket/43224>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list