From a9e08b6de5eb929f1f2204683810e2c4ca11860a Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 29 Jan 2026 17:29:39 +0000 Subject: [PATCH] Bug 39164: Strip the wrapper before validaing the SQL --- Koha/Report.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Koha/Report.pm b/Koha/Report.pm index cb7f8fdcf56..a857d188359 100644 --- a/Koha/Report.pm +++ b/Koha/Report.pm @@ -58,6 +58,9 @@ sub is_sql_valid { $sql //= ''; my @errors = (); + #strip the 'SET STATEMENT max_statement_time=%d FOR %s' bit added in Bug 39164 before validating the SQL + $sql =~ s/^\s*SET\s+STATEMENT\s+max_statement_time\s*=\s*\d+\s+FOR\s+//i; + if ( $sql =~ /;?\W?(UPDATE|DELETE|DROP|INSERT|SHOW|CREATE)\W/i ) { push @errors, { sqlerr => $1 }; } elsif ( $sql !~ /^\s*SELECT\b\s*/i ) { -- 2.39.5