Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #58206


Ignore:
Timestamp:
04/27/2023 12:44:29 PM (12 months ago)
Author:
SergeyBiryukov
Comment:

Replying to dingo_d:

str_starts_with is PHP 8+ syntax, so you cannot just replace strpos checks with it until the minimum PHP version is raised to PHP 8 if I'm not mistaken...

WordPress core includes a polyfill for str_contains() as of [52039] / #49652, as well as str_starts_with() and str_ends_with() as of [52040] / #54377, so the change should be safe to make, see the discussion in #58012.

This ticket is about str_contains() though, updating the description to avoid confusion.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #58206

    • Property Milestone changed from Awaiting Review to 6.3
  • Ticket #58206 – Description

    initial v3  
    1 Replace usage of false === strpos or false !== strpos with str_starts_with. It makes the code more readable and use a PHP native function ( which may have a performance benefit ).
     1Replace usage of `false === strpos` or `false !== strpos` with `str_contains`. It makes the code more readable and use a PHP native function ( which may have a performance benefit ).
    22
    3 Follow on from #58012
     3Follow on from #58012.