From 55e42683f80d1a62c966917f262fbd05b33495b9 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:30:55 +1300 Subject: [PATCH] FIX Match multi-line JOIN statements (#10960) --- 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 03cc57758..d128124b5 100644 --- a/src/ORM/Queries/SQLConditionalExpression.php +++ b/src/ORM/Queries/SQLConditionalExpression.php @@ -802,6 +802,6 @@ abstract class SQLConditionalExpression extends SQLExpression */ 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 000000000..b3cb4eaef --- /dev/null +++ b/tests/php/ORM/DBQueryBuilderTest.php @@ -0,0 +1,27 @@ +assertSame('FROM SomeTable ' . $join, trim($builder->buildFromFragment($select, $params))); + } +}