[wp-trac] [WordPress Trac] #58206: Replace usage of strpos with str_contains

WordPress Trac noreply at wordpress.org
Tue Jun 27 23:03:02 UTC 2023


#58206: Replace usage of strpos with str_contains
-------------------------------------+-------------------------------------
 Reporter:  spacedmonkey             |       Owner:  SergeyBiryukov
     Type:  enhancement              |      Status:  reopened
 Priority:  normal                   |   Milestone:  6.3
Component:  General                  |     Version:
 Severity:  blocker                  |  Resolution:
 Keywords:  good-first-bug 2nd-      |     Focuses:  performance, coding-
  opinion has-patch needs-testing    |  standards
-------------------------------------+-------------------------------------

Comment (by ironprogrammer):

 == Test Report
 This validates the fix applied to `update-core.php` in
 https://github.com/WordPress/wordpress-develop/pull/4728.

 === Steps to Test Patch
 1. Install a fresh copy of WordPress 5.8 or earlier.
 2. Enable debug mode and logging to track errors (`WP_DEBUG`,
 `WP_DEBUG_LOG`). Enable `SCRIPT_DEBUG` to workaround known issue explained
 in Additional Information below.
 3. Follow these steps to build a custom WordPress installation package
 with the patch applied to it:
 {{{
 #!python

 # change directory to test site root, e.g.
 cd ~/Sites/wp-install-test/

 # PREPARE CUSTOM PACKAGE ZIP
 # download 6.3-beta1 (or update to a newer zip if needed)
 curl -O https://downloads.wordpress.org/release/wordpress-6.3-beta1.zip
 unzip wordpress-6.3-beta1.zip

 # download patch file for PR 4728 (for update-core.php)
 cd wordpress
 curl -O https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-
 develop/pull/4728.diff

 # apply patch
 patch wp-admin/includes/update-core.php 4728.diff
 # should show: patching file wp-admin/includes/update-core.php

 # now zip the customized package
 cd ..
 zip -r wordpress-custom.zip wordpress
 # NOTE: Custom ZIP file MUST be accessible at:
 #   http://<your-test.site>/wordpress-custom.zip

 # PREPARE CUSTOM UPDATE PLUGIN
 # install custom wordpress update plugin
 curl
 https://gist.githubusercontent.com/ironprogrammer/1aaff6f60b263c1842e3584365729ffc/raw/9731d0c07b377684052c43c4df2b025032130310
 /fake-wordpress-update.php -o wp-content/plugins/fake-wordpress-update.php
 # enable the plugin
 wp plugin activate fake-wordpress-update
 }}}
 4. In WP admin, navigate to ''Dashboard > Updates''.
 5. Click the "Update to version 6.3.0-custom" button to install the
 patched package.

 === Expected Results
 - ✅ Site should upgrade to the custom package without errors.

 === Environment
 - Hardware: MacBook Pro Apple M1 Pro
 - OS: macOS 13.4.1
 - Browser: Safari 16.5.1
 - Server: nginx/1.25.0
 - PHP: 7.4.33
 - WordPress: 5.8 -> 6.3-beta1
 - Theme: twentytwentyone v1.8
 - Active Plugins:
  - fake-wordpress-update v1.0.0
 ([https://gist.github.com/ironprogrammer/1aaff6f60b263c1842e3584365729ffc
 #file-fake-wordpress-update-php custom package installer from this gist])
  - db.php (using SQLite)

 === Actual Results
 When testing the bugfix patch:
 - ✅ Site upgraded without issue.

 === Additional Information
 Before the 6.3 Beta 1 build is officially released, there is a
 [https://github.com/WordPress/wordpress-develop/pull/4727 known issue]
 with CSS in WP admin when `SCRIPT_DEBUG` is not enabled.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58206#comment:54>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list