diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 8ae58299d6..0dec6df4f5 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -5553,8 +5553,11 @@ function _device_can_upload() {
  * @return bool True if the path is a stream URL.
  */
 function wp_is_stream( $path ) {
-	$wrappers    = stream_get_wrappers();
-	$wrappers    = array_map( 'preg_quote', $wrappers );
+	$wrappers = stream_get_wrappers();
+	foreach ( $wrappers as &$wrapper ) {
+		$wrapper = preg_quote( $wrapper, '!' );
+	}
+
 	$wrappers_re = '(' . join( '|', $wrappers ) . ')';
 
 	return preg_match( "!^$wrappers_re://!", $path ) === 1;
