WordPress.org

Make WordPress Core

Ticket #49652: 49652-1.patch

File 49652-1.patch, 463 bytes (added by ayeshrajans, 2 months ago)

Here is a patch to polyfill. We can replace instances with strpos() !== false instances in core if we have this core.

  • src/wp-includes/compat.php

    diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php
    index 2e258a88ea..3370d165b4 100644
    a b function is_iterable( $var ) { 
    374374                return ( is_array( $var ) || $var instanceof Traversable );
    375375        }
    376376}
     377
     378if ( ! function_exists( 'str_contains' ) ) {
     379        function str_contains( $haystack, $needle ) {
     380                return '' === $needle || false !== strpos( $haystack, $needle );
     381        }
     382}