From 196f14f8df5fd4a5b61fcec0f8dc48dfe67cf472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Wed, 25 Aug 2021 21:16:05 +0200 Subject: [PATCH] Error out if incompatible DBAL version is detected doctrine/dbal is an optional dependency of laravel/framework, and v3 of the DBAL has been released recently, but obviously, Laravel 6 was never meant to be compatible with that version. Users still using Laravel 6 and updating their dependencies get confused and file invalid reports on the DBAL, see for instance doctrine/dbal#4439 or doctrine/dbal#4757 Fixes laravel#24271 --- src/Illuminate/Database/SQLiteConnection.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Illuminate/Database/SQLiteConnection.php b/src/Illuminate/Database/SQLiteConnection.php index 4990fdd299a1..ba64518f037f 100755 --- a/src/Illuminate/Database/SQLiteConnection.php +++ b/src/Illuminate/Database/SQLiteConnection.php @@ -7,6 +7,7 @@ use Illuminate\Database\Query\Processors\SQLiteProcessor; use Illuminate\Database\Schema\Grammars\SQLiteGrammar as SchemaGrammar; use Illuminate\Database\Schema\SQLiteBuilder; +use LogicException; class SQLiteConnection extends Connection { @@ -85,6 +86,12 @@ protected function getDefaultPostProcessor() */ protected function getDoctrineDriver() { + if (! class_exists(DoctrineDriver::class)) { + throw new LogicException( + 'Laravel v6 is only compatible with doctrine/dbal 2, lock it to that version with composer require doctrine/dbal "^2.0"' + ); + } + return new DoctrineDriver; }