From 142035f221b17e0ce0c846e15afb67f437c2d7a3 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 26 Sep 2023 09:41:54 +1300 Subject: [PATCH] FIX Match multi-line JOIN statements --- src/ORM/Queries/SQLConditionalExpression.php | 2 +- tests/php/ORM/DBQueryBuilderTest.php | 27 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 tests/php/ORM/DBQueryBuilderTest.php diff --git a/src/ORM/Queries/SQLConditionalExpression.php b/src/ORM/Queries/SQLConditionalExpression.php index 03cc577582a..d128124b5fb 100644 --- a/src/ORM/Queries/SQLConditionalExpression.php +++ b/src/ORM/Queries/SQLConditionalExpression.php @@ -802,6 +802,6 @@ public function toUpdate() */ public static function getJoinRegex(): string { - return '/JOIN +.*? +(AS|ON|USING\(?) +/i'; + return '/JOIN\s+.*?\s+(AS|ON|USING\(?)\s+/is'; } } diff --git a/tests/php/ORM/DBQueryBuilderTest.php b/tests/php/ORM/DBQueryBuilderTest.php new file mode 100644 index 00000000000..b3cb4eaef67 --- /dev/null +++ b/tests/php/ORM/DBQueryBuilderTest.php @@ -0,0 +1,27 @@ +assertSame('FROM SomeTable ' . $join, trim($builder->buildFromFragment($select, $params))); + } +}