In BSR & BSR-PRO v1.4.6, we introduced an early return to skip out of recursive search/replace in serialized data if the target $data is a string (as opposed to object or array) but doesn't contain the search term. However, the early return logic always uses strpos() regardless of what the $case_insensitivesetting is.
In this PR, this is changed so that we select strpos() or stripos() for comparing strings depending on the value of $case_insensitive.
To test
Using version 1.4.6:
Add serialized data containing uppercase text to the options table:
wp option update --format=json foobar '{"value":"UPPERCASE"}'
In BSR, do a dry-run search for "uppercase" in wp_options with Case-Insensitive checked.
Note that it reports zero hits.
Run the search/replace anyway.
Verify that nothing was changed and that foobar still contains "UPPERCASE":
wp option get foobar
Using this PR:
In BSR, do a dry-run search for "uppercase" in wp_options with Case-Insensitive unchecked.
Note that it reports 0 hits.
Do another dry-run search for "uppercase" in wp_options, this time with Case-Insensitive checked.
Note that it now reports 1 hit.
Run the search/replace.
Verify that "UPPERCASE" was replaced with the new value:
wp option get foobar
Resolves: DELI-1014
In BSR & BSR-PRO v1.4.6, we introduced an early return to skip out of recursive search/replace in serialized data if the target $data is a string (as opposed to object or array) but doesn't contain the search term. However, the early return logic always uses
strpos()
regardless of what the$case_insensitive
setting is.In this PR, this is changed so that we select
strpos()
orstripos()
for comparing strings depending on the value of$case_insensitive
.To test
Using version 1.4.6:
wp option update --format=json foobar '{"value":"UPPERCASE"}'
wp option get foobar
Using this PR:
wp option get foobar