Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

With mySQL >= 8.0 various DB queries fails due to obsolete regexp (patch included) #114

Open
pms967 opened this issue Aug 19, 2023 · 0 comments

Comments

@pms967
Copy link

pms967 commented Aug 19, 2023

DocDB has several issues when used with an up to date version of mySQL (>=8.0). One such a problem affects the search function:

AH01215: DBD::mysql::st execute failed: Illegal argument to a regular expression. at /var/www/docdb/cgi.pro/Search.pm line 283.: /var/www/docdb/cgi/Search

this error in turn cause the query to fail -> search does not work.

I've traced back this problem to an obsolete regexp format defined in the file "SearchAtoms.pm".

From: https://stackoverflow.com/questions/59998409/error-code-3685-illegal-argument-to-a-regular-expression

According to MySQL 8.0 Reference Manual, "MySQL implements regular expression support using International Components for Unicode (ICU)."

According to MySQL 5.6 Reference Manual , "MySQL uses Henry Spencer's implementation of regular expressions."

Therefore, with MySQL 8.0, rather than using [[:<:]] and [[:>:]], you must now use \b.

Here follows the trivial patch which fixes the problem:

--- ../../DocDB-8.8.9/cgi/SearchAtoms.pm	2018-06-26 20:19:08.000000000 +0200
+++ ./SearchAtoms.pm	2023-08-19 17:37:53.275499659 +0200
@@ -113,13 +122,15 @@
   }
 
   if ($RequireWord) {
-    $RegExpAtom .= '[[:<:]]';
+    # $RegExpAtom .= '[[:<:]]'; # does not work with mySQL >= 8.0 !
+    $RegExpAtom .= '\b';
   }
   $RegExpAtom .= '(';
   $RegExpAtom .= join '|', @RegExpParts;
   $RegExpAtom .= ')';
   if ($RequireWord) {
-    $RegExpAtom .= '[[:>:]]';
+    # $RegExpAtom .= '[[:>:]]';  # does not work with mySQL >= 8.0 !
+    $RegExpAtom .= '\b';
   }
 
   my $SafeAtom = $dbh->quote($RegExpAtom);
@pms967 pms967 changed the title With mySQL >= 8.0 various DB queries fails due to obsolete regexp With mySQL >= 8.0 various DB queries fails due to obsolete regexp (patch included) Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant