From dc3167b9696e9adbb3834a39453c2cc5575c65c4 Mon Sep 17 00:00:00 2001 From: Takuho NAKANO Date: Sun, 22 Nov 2020 03:06:57 +0900 Subject: [PATCH] Avoid matching in a word in is_write_query() (#95) Co-authored-by: John James Jacoby --- ludicrousdb/includes/class-ludicrousdb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ludicrousdb/includes/class-ludicrousdb.php b/ludicrousdb/includes/class-ludicrousdb.php index 55b1146..baf3973 100644 --- a/ludicrousdb/includes/class-ludicrousdb.php +++ b/ludicrousdb/includes/class-ludicrousdb.php @@ -406,7 +406,7 @@ public function is_write_query( $q = '' ) { $q = ltrim( $q, "\r\n\t (" ); // Possible writes - if ( preg_match( '/(?:ALTER|CREATE|ANALYZE|CHECK|OPTIMIZE|REPAIR|CALL|DELETE|DROP|INSERT|LOAD|REPLACE|UPDATE|SET|RENAME)(?:\s|$)/i', $q ) ) { + if ( preg_match( '/(?:^|\s)(?:ALTER|CREATE|ANALYZE|CHECK|OPTIMIZE|REPAIR|CALL|DELETE|DROP|INSERT|LOAD|REPLACE|UPDATE|SET|RENAME\s+TABLE)(?:\s|$)/i', $q ) ) { return true; }