Make WordPress Core

Opened 7 months ago

Closed 6 months ago

Last modified 6 months ago

#60241 closed defect (bug) (fixed)

Revert usage of str_contains() in older bundled themes

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.4.3 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords:
Focuses: Cc:

Description

Background: #58206.

In [55988], instances of false !== strpos( ... ) were replaced with str_contains() in core files, including the Twenty Twenty and Twenty Seventeen bundled themes.

As pointed out by @poena, the polyfill for str_contains() is only available in WordPress 5.9 or later, while Twenty Twenty supports WordPress 4.7 and PHP 5.2.4, where the use of str_contains() causes fatal errors. This applies to Twenty Seventeen too.

Full list of changes that should be reverted: [55988/trunk/src/wp-content/themes].

Change History (14)

#1 @SergeyBiryukov
7 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#2 @SergeyBiryukov
7 months ago

In 57275:

Twenty Seventeen: Revert usage of str_contains() in theme files.

The theme supports WordPress 4.7 or later, while the polyfill for str_contains() only exists in WordPress 5.9 or later.

Follow-up to [55988].

Props poena.
See #60241.

#3 @SergeyBiryukov
7 months ago

In 57276:

Twenty Twenty: Revert usage of str_contains() in theme files.

The theme supports WordPress 4.7 or later, while the polyfill for str_contains() only exists in WordPress 5.9 or later.

Follow-up to [55988], [57275].

Props poena.
See #60241.

#4 @SergeyBiryukov
7 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 57277:

Twenty Twenty-One: Revert usage of str_contains() in theme files.

The theme supports WordPress 5.3 or later, while the polyfill for str_contains() only exists in WordPress 5.9 or later.

Follow-up to [55988], [57275], [57276].

Props poena.
Fixes #60241.

#5 @sabernhardt
7 months ago

Thanks. #58012 avoided changing to str_starts_with in bundled themes, but I apparently missed the switch to str_contains.

#6 @poena
6 months ago

@desrosj @onemaggie I think we need to release new versions of these themes, outside the normal release cycle, since the issue caused fatal errors.

#7 @desrosj
6 months ago

Thanks for catching and working on this all!

I agree, an out of cycle release makes sense. I'm going to work on that now!

#8 @desrosj
6 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening because if there are additional changes to these themes in trunk, it may make more sense to backport the changes and release from the 6.4 branch.

#9 @desrosj
6 months ago

In 57291:

Twenty Seventeen: Revert usage of str_contains() in theme files.

The theme supports WordPress 4.7 or later, while the polyfill for str_contains() only exists in WordPress 5.9 or later.

Follow-up to [55988].

Merges [57275] to the 6.4 branch.

Props poena, SergeyBiryukov.
See #60241.

#10 @desrosj
6 months ago

In 57292:

Twenty Twenty: Revert usage of str_contains() in theme files.

The theme supports WordPress 4.7 or later, while the polyfill for str_contains() only exists in WordPress 5.9 or later.

Follow-up to [55988], [57275].

Merges [57276] to the 6.4 branch.

Props poena, SergeyBiryukov.
See #60241.

#11 @desrosj
6 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 57293:

Twenty Twenty-One: Revert usage of str_contains() in theme files.

The theme supports WordPress 5.3 or later, while the polyfill for str_contains() only exists in WordPress 5.9 or later.

Follow-up to [55988], [57275], [57276].

Merges [57277] to the 6.4 branch.

Props poena, SergeyBiryukov.
Fixes #60241.

#12 @jorbin
6 months ago

  • Milestone changed from 6.5 to 6.4.3

Adjusting the version since the changes are being backported.

#14 @sabernhardt
6 months ago

I added a link on the ticket number in the Twenty Seventeen changelog and mentioned the earlier change from #58206 under version 3.3.

However, I cannot edit the other two changelogs (fixing the 60241 link and mentioning the change two versions earlier).

Note: See TracTickets for help on using tickets.