id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 45553 Improve wp_is_stream() performance swissspidy pento "The `wp_is_stream()` function (used by functions like `wp_normalize_path()` currently uses a dynamically constructed regex to detect streams. This could be verified a lot by using `in_array()` instead. @schlessera suggested the following version over at https://github.com/wp-cli/wp-cli/issues/5008: {{{#!php function wp_is_stream( $path ) { $scheme_separator = strpos( $path, '://' ); if ( false === $scheme_separator ) { // $path isn't a stream return false; } $stream = substr( $path, 0, $scheme_separator ); return in_array( $stream, stream_get_wrappers(), true ); } }}} [https://3v4l.org/BTHk0 A quick benchmark] shows that this is around four times faster than the current method." enhancement closed low 5.1 Filesystem API minor fixed has-patch