Make WordPress Core

Opened 7 months ago

Closed 7 months ago

#64773 closed defect (bug) (fixed)

Code Modernization: Replace usage of strpos() with str_starts_with().

Reported by: Soean Owned by: SergeyBiryukov
Priority: normal Milestone: 7.0
Component: General Version:
Severity: normal Keywords: has-patch commit
Cc: Focuses:

Description (last modified by SergeyBiryukov)

In 2023 we replaced 0 === strpos() with str_starts_with() see #58012

In 2024 we introduced a new 0 === strpos() see [58313].

To improve readability and performance, we should also update it with str_starts_with().

Change History (6)

This ticket was mentioned in PR #11107 on WordPress/wordpress-develop by @Soean.


7 months ago
#1

  • Keywords has-patch added

#2 @mukesh27
7 months ago

  • Keywords commit added

@SergeyBiryukov Can we mark this as bug and move into 7.0 milestone?

#3 @SergeyBiryukov
7 months ago

  • Milestone Awaiting Review7.0
  • Owner set to SergeyBiryukov
  • Status newaccepted

#4 @SergeyBiryukov
7 months ago

  • Type enhancementdefect (bug)

#5 @SergeyBiryukov
7 months ago

  • Description modified (diff)

#6 @SergeyBiryukov
7 months ago

  • Resolutionfixed
  • Status acceptedclosed

In 61781:

Code Modernization: Use str_starts_with() in WP_Duotone class methods.

This aims to make the code more readable and consistent, as the function is already used extensively in core files.

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

Follow-up to [55703], [58313].

Props Soean, mukesh27.
Fixes #64773.

Note: See TracTickets for help on using tickets.