Problem/Motivation

In Drupal core, strpos() which compares with FALSE or 0 is already replaced in #3324560: Replace strpos/substr with str_starts_with() / str_contains() / str_ends_with(). Now str_contains() and str_starts_with() can use since PHP 8 so module supporting Drupal 10+ can replace these code.

Proposed resolution

strpos($a, $b) compares with FALSE or 0 replace like following list if possible.

  1. strpos($a, $b) !== FALSE replace with str_contains($a, $b)
  2. strpos($a, $b) === FALSE replace with !str_contains($a, $b)
  3. strpos($a, $b) === 0 replace with str_starts_with($a, $b)
  4. strpos($a, $b) !== 0 replace with !str_starts_with($a, $b)

Remaining tasks

TBD

User interface changes

API changes

Data model changes

Issue fork webform-3524067

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tom konda created an issue. See original summary.

tom konda’s picture

Status: Active » Needs review
jrockowitz’s picture

@tom konda You earned yourself a commit credit

  • jrockowitz committed c97475c7 on 6.3.x authored by tom konda
    Issue #3524067 by tom konda: strpos($a, $b) which compares with FALSE or...
jrockowitz’s picture

Status: Needs review » Fixed

  • jrockowitz committed c97475c7 on 6.x authored by tom konda
    Issue #3524067 by tom konda: strpos($a, $b) which compares with FALSE or...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.