• Resolved apticknor

    (@apticknor)


    Hello, recently our server was upgraded from MySQL 5.7 to 8.x

    Since that time the functionality to add related posts to our blog posts isn’t working. Specifically the meta box shows up but the search box never returns results.

    I reviewed the server logs and see the following error message.

    [2023-10-13T15:52:32.695983+00:00] WordPress database error Illegal argument to a regular expression. for query #012#011#011#011#011#011SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.ID#012#011#011#011#011#011FROM wp_posts  INNER JOIN wp_postmeta AS a ON ( a.post_id = wp_posts.ID ) LEFT JOIN wp_postmeta AS b ON ( (( b.post_id = a.post_id )) AND (( b.meta_key LIKE CONCAT( '\_', a.meta_key ) )) ) #012#011#011#011#011#011WHERE 1=1  AND ( ( ( b.meta_id IS NOT NULL )  AND ( a.meta_value REGEXP '[[:<:]]manager[[:>:]]' ) ) OR ( ( wp_posts.post_title REGEXP '[[:<:]]manager[[:>:]]' ) OR ( wp_posts.post_content REGEXP '[[:<:]]manager[[:>:]]' ) OR ( wp_posts.post_excerpt REGEXP '[[:<:]]manager[[:>:]]' ) ) )  AND wp_posts.post_type IN ('news', 'webinars', 'events') AND ((wp_posts.post_status <> 'trash' AND wp_posts.post_status <> 'auto-draft'))#012#011#011#011#011#011#012#011#011#011#011#011ORDER BY wp_posts.post_date DESC#012#011#011#011#011#011LIMIT 0, 15#012#011#011#011#011 /* From [www.redacted.com/wp-admin/admin-ajax.php?crp_ajax=1] in [/nas/content/live/redacted/wp-content/plugins/custom-related-posts/helpers/ajax.php:52] */ made by do_action('wp_ajax_crp_search_posts'), WP_Hook->do_action, WP_Hook->apply_filters, CRP_Ajax->ajax_search_posts, WP_Query->__construct, WP_Query->query, WP_Query->get_posts

    I did some searching on the error and found that Illegal argument to a regular expression is a common error after the upgrade and there’s even some discussion on the mysql website – https://bugs.mysql.com/bug.php?id=106504

    I’m wondering if there’s a timeline for an update so the plugin works with MySQL 8 or if a patch is available.

    Let me know if I can provide any other info.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Brecht

    (@brechtvds)

    Hi there,

    We actually use a regular WP_Query using the ‘s’ parameter for searching. Basically we’re just using default WordPress functionality without querying the database directly. So at no point are we writing any of that SQL. It’s WP itself doing that, and out of our control.

    What version of WordPress do you have installed?

    Thread Starter apticknor

    (@apticknor)

    WordPress version is 6.3.

    I’ll see if I can setup a reduced test case to rule out other plugins / themes.

    Thread Starter apticknor

    (@apticknor)

    I found the issue. ACF Better Search modifies WordPress core search and has an option to select if you’re on MySQL 8.x to use the new REGEX syntax. Selecting that option made things start working again.

    Thanks for the fast response and for making a great plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘MySQL 8 issue’ is closed to new replies.