Closed (fixed)
Project:
Drupal core
Version:
10.1.x-dev
Component:
other
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
20 Dec 2022 at 23:33 UTC
Updated:
23 Dec 2025 at 22:04 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
xjmComment #4
xjmComment #5
xjmComment #6
xjmComment #7
xjmComment #8
xjmComment #9
xjmComment #10
rpayanmThe patch does not apply anymore.
Comment #11
xjmFixed the merge conflict, which was due to some code adopting
str_starts_with()and using a slightly different logic structure than the one in HEAD.Comment #12
rpayanmI reviewed the patch like this:

1. Checked out the branch 10.1.x and pulled the latest changes, applied this patch.
2. Checked the patterns
strpos($haystack, $needle) === 0andstrpos($haystack, $needle, 0) === 0become tostr_starts_with($haystack, $needle). Andstrpos($haystack, $needle) !== 0become!str_starts_with($haystack, $needle). I checked each change visually with a Phpstorm tool (Compare with branch) on every changed line, it looks like this:Everything was fine!
3. Searched for the
strpospatterns mentioned before in the Drupal core code. But I found some changes to be done:core/lib/Drupal/Core/Config/Entity/Query/Query.php:
strpos($id, $value) === 0core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/PhpSelection.php:
strpos($label, $match) === 0core/lib/Drupal/Core/Config/Entity/Query/Condition.php:
strpos($value, $condition['value']) === 0core/lib/Drupal/Core/ParamConverter/EntityConverter.php:
if (strpos($definition['type'], '{') !== FALSE) {core/modules/image/src/PathProcessor/PathProcessorImageStyles.php:
if (strpos($path, '/' . $directory_path . '/styles/') === 0) {core/modules/path_alias/src/PathProcessor/AliasPathProcessor.php:
if (strpos($path, '//') === 0) {Comment #13
xjmThanks @rpayanm.
These are explicitly excluded from the scope to avoid merge conflicts for the other three sibling merge requests. As per the issue summary:
The idea is to merge these four conflict-free merge requests, then clean up the last dangling references in a final issue. That's why the title starts with "Replace most ..." :)
See #3324560: Replace strpos/substr with str_starts_with() / str_contains() / str_ends_with() for more information.
Comment #14
rpayanmoh! great, so the patch looks good to me.
Comment #15
xjmSaving credits.
Comment #19
xjmAdding credits from the original MR. (All I did was split it up; others created it first.)
Comment #21
catchAll the changes look good. Agreed with doing the easy ones here and stragglers at the end.