Make WordPress Core

Changeset 60901

Timestamp:
10/05/2025 07:04:21 PM (6 days ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Use str_contains() in get_shortcode_tags_in_content().

str_contains() was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for str_contains() on PHP < 8.0 as of WordPress 5.9.

Follow-up to [52039], [55988], [56245], [56838], [60900].

See #63168.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/shortcodes.php

    r58197 r60901  
    183183 */
    184184function get_shortcode_tags_in_content( $content ) {
    185     if ( false === strpos( $content, '[' ) ) {
     185    if ( ! str_contains( $content, '[' ) ) {
    186186        return array();
    187187    }
Note: See TracChangeset for help on using the changeset viewer.