File tree 3 files changed +13
-15
lines changed
3<
8000
!-- --> files changed +13
-15
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Cache \Adapter ;
13
13
14
14
use Doctrine \DBAL \Connection ;
15
- use Doctrine \DBAL \Driver \PDO \Exception ;
16
15
use Doctrine \DBAL \Schema \Schema ;
17
16
use Psr \Cache \CacheItemInterface ;
18
17
use Psr \Log \LoggerInterface ;
@@ -600,15 +599,15 @@ private function getServerVersion(): string
600
599
601
600
private function isTableMissing (\PDOException $ exception ): bool
602
601
{
603
- $ exception = Exception::new ($ exception );
604
602
$ driver = $ this ->driver ;
603
+ [$ sqlState , $ code ] = $ exception ->errorInfo ?? [null , $ exception ->getCode ()];
605
604
606
605
switch (true ) {
607
- case 'pgsql ' === $ driver && '42P01 ' === $ exception -> getSQLState () :
606
+ case 'pgsql ' === $ driver && '42P01 ' === $ sqlState :
608
607
case 'sqlite ' === $ driver && str_contains ($ exception ->getMessage (), 'no such table: ' ):
609
- case 'oci ' === $ driver && 942 === $ exception -> getCode () :
610
- case 'sqlsrv ' === $ driver && 208 === $ exception -> getCode () :
611
- case 'mysql ' === $ driver && 1146 === $ exception -> getCode () :
608
+ case 'oci ' === $ driver && 942 === $ code :
609
+ case 'sqlsrv ' === $ driver && 208 === $ code :
610
+ case 'mysql ' === $ driver && 1146 === $ code :
612
611
return true ;
613
612
default :
614
613
return false ;
Original file line number Diff line number Diff line change @@ -95,11 +95,11 @@ public static function provideDsnSQLite()
95
95
/**
96
96
* @requires extension pdo_pgsql
97
97
*
98
- * @group integration
98
+ * @group szn
99
99
*/
100
100
public function testDsnWithPostgreSQL ()
101
101
{
102
- if (!$ host = getenv ( ' POSTGRES_HOST ' ) ) {
102
+ if (!$ host = ' localhost ' ) {
103
103
$ this ->markTestSkipped ('Missing POSTGRES_HOST env variable ' );
104
104
}
105
105
Original file line number Diff line number Diff line change 12
12
namespace Symfony \Component \Lock \Store ;
13
13
14
14
use Doctrine \DBAL \Connection ;
15
- use Doctrine \DBAL \Driver \PDO \Exception ;
16
15
use Doctrine \DBAL \Schema \Schema ;
17
16
use Symfony \Component \Lock \Exception \InvalidArgumentException ;
18
17
use Symfony \Component \Lock \Exception \InvalidTtlException ;
@@ -330,15 +329,15 @@ private function getCurrentTimestampStatement(): string
330
329
331
330
private function isTableMissing (\PDOException $ exception ): bool
332
331
{
333
- $ exception = Exception:: new ( $ exception );
334
- $ driver = $ this -> driver ;
332
+ $ driver = $ this -> getDriver ( );
333
+ [ $ sqlState , $ code ] = $ exception -> errorInfo ?? [ null , $ exception -> getCode ()] ;
335
334
336
335
switch (true ) {
337
- case 'pgsql ' === $ driver && '42P01 ' === $ exception -> getSQLState () :
336
+ case 'pgsql ' === $ driver && '42P01 ' === $ sqlState :
338
337
case 'sqlite ' === $ driver && str_contains ($ exception ->getMessage (), 'no such table: ' ):
339
- case 'oci ' === $ driver && 942 === $ exception -> getCode () :
340
- case 'sqlsrv ' === $ driver && 208 === $ exception -> getCode () :
341
- case 'mysql ' === $ driver && 1146 === $ exception -> getCode () :
338
+ case 'oci ' === $ driver && 942 === $ code :
339
+ case 'sqlsrv ' === $ driver && 208 === $ code :
340
+ case 'mysql ' === $ driver && 1146 === $ code :
342
341
return true ;
343
342
default :
344
343
return false ;
You can’t perform that action at this time.
0 commit comments