diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
index f9f5be10cea..7bb04f8fc3d 100644
--- src/wp-admin/includes/file.php
+++ src/wp-admin/includes/file.php
@@ -2356,7 +2356,7 @@ function wp_opcache_invalidate( $filepath, $force = false ) {
 	}
 
 	// Verify that file to be invalidated has a PHP extension.
-	if ( ! preg_match( '/\.(?:php)$/i', $filepath ) ) {
+	if ( '.php' !== strtolower( substr( $filepath, -4 ) ) ) {
 		return false;
 	}
 
