johngodley / search-regex

Search Regex adds a powerful set of search and replace functions to WordPress that go beyond the standard searching capabilities, with full regex support.
https://searchregex.com
GNU General Public License v3.0
32 stars 8 forks source link

Double quotes in Search phrase replaces data in the wrong Terms table #189

Open zaderade opened 1 month ago

zaderade commented 1 month ago

Summary

This plugin is amazing, thank you!

Unfortunately, trying to replace 1/2" with ½" or 1/2inch using Terms as the Advanced Source type results in a correct preview, but the replaced data overwrites rows in a different table.

Here are my settings: https://a.cl.ly/DOu19bdn

Here's my wp_terms, highlighting the same results as in Search Regex's preview: https://a.cl.ly/Z4u9yW20

Upon clicking Replace, I would expect wp_terms.name for term_id 57 to change from Iron Finials for 1/2" rods to Iron Finials for ½" rods (and similarly for term_id 67). But after performing a replace, repeating the search still shows the same 2 matched rows..

Actual Behavior

Here's my wp_term_taxonomy, highlighting the rows that will get unexpectedly overwritten: https://a.cl.ly/X6ujdZjJ

When I do a replacement (either via the Replace All button or via clicking a highlighted phrase and using the single replacement popup), what happens is wp_terms.name remains unchanged, and wp_term_taxonomy.description for term_id 57 changes to Iron Finials for ½" rods: https://a.cl.ly/NQu91yQW

Steps to reproduce

In case this is relevant, here is the full content of wp_term_taxonomy.description for term_id 57, which gets entirely overwritten: https://a.cl.ly/jku0D9ND

Even if I specifically set the Action to Modify Matches only on the Name column (https://a.cl.ly/kpuvwX0m), the issue persists.

Using the Health Check & Troubleshooting plugin to switch to a default theme (Twenty Twenty-Three) and disable all other plugins except for WooCommerce, I was still able to replicate the problem, even after also adding a Terms filter and switching my replacement text to 1/2inch, as shown in this screenshot: https://a.cl.ly/L1uEQLKq

Thus, I suspect the issue boils down to using double quotes in the Search input with Terms as the Source.

Environment

WordPress (6.6.2) and Search Regex (3.1.0) are up to date, as is WooCommerce (9.3.1). I'm using Safari 17.6 (against my better judgment) but I doubt that's relevant.

wp-server

server_architecture: Linux 3.10.0-1127.10.1.el7.x86_64 x86_64 httpd_software: Apache php_version: 8.2.22 64bit php_sapi: fpm-fcgi max_input_variables: 1000 time_limit: 600 memory_limit: 512M max_input_time: 180 upload_max_filesize: 32M php_post_max_size: 128M curl_version: 8.9.1 OpenSSL/1.1.1w suhosin: false imagick_availability: true pretty_permalinks: true htaccess_extra_rules: true current: 2024-09-17T06:43:11+00:00 utc-time: Tuesday, 17-Sep-24 06:43:11 UTC server-time: 2024-09-17T00:43:08-06:00

wp-database

extension: mysqli server_version: 10.6.19-MariaDB client_version: mysqlnd 8.2.22 max_allowed_packet: 268435456 max_connections: 150

wp-constants

WP_HOME: undefined WP_SITEURL: undefined WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 512M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: true CONCATENATE_SCRIPTS: false COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined WP_DEVELOPMENT_MODE: undefined DB_CHARSET: utf8mb4 DB_COLLATE: utf8mb4_unicode_ci

zaderade commented 1 month ago

Upon further investigation, searching for any text in wp_term_taxonomy.description produces zero results within that table.