File tree 2 files changed +13
-11
lines changed 2 files changed +13
-11
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 ;
15
16
use Doctrine \DBAL \Schema \Schema ;
16
17
use Psr \Cache \CacheItemInterface ;
17
18
use Psr \Log \LoggerInterface ;
@@ -599,15 +600,15 @@ private function getServerVersion(): string
599
600
600
601
private function isTableMissing (\PDOException $ exception ): bool
601
602
{
603
+ $ exception = Exception::new ($ exception );
602
604
$ driver = $ this ->driver ;
603
- $ code = $ exception ->errorInfo ? $ exception ->errorInfo [1 ] : $ exception ->getCode ();
604
605
605
606
switch (true ) {
606
- case 'pgsql ' === $ driver && str_contains ( $ exception ->getMessage (), ' 42P01 ' ):
607
+ case 'pgsql ' === $ driver && ' 42P01 ' === $ exception ->getSQLState ( ):
607
608
case 'sqlite ' === $ driver && str_contains ($ exception ->getMessage (), 'no such table: ' ):
608
- case 'oci ' === $ driver && 942 === $ code :
609
- case 'sqlsrv ' === $ driver && 208 === $ code :
610
- case 'mysql ' === $ driver && 1146 === $ code :
609
+ case 'oci ' === $ driver && 942 === $ exception -> getCode () :
610
+ case 'sqlsrv ' === $ driver && 208 === $ exception -> getCode () :
611
+ case 'mysql ' === $ driver && 1146 === $ exception -> getCode () :
611
612
return true ;
612
613
default :
613
614
return false ;
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 ;
15
16
use Doctrine \DBAL \Schema \Schema ;
16
17
use Symfony \Component \Lock \Exception \InvalidArgumentException ;
17
18
use Symfony \Component \Lock \Exception \InvalidTtlException ;
@@ -329,15 +330,15 @@ private function getCurrentTimestampStatement(): string
329
330
330
331
private function isTableMissing (\PDOException $ exception ): bool
331
332
{
332
- $ driver = $ this -> getDriver ( );
333
- $ code = $ exception -> errorInfo ? $ exception -> errorInfo [ 1 ] : $ exception -> getCode () ;
333
+ $ exception = Exception:: new ( $ exception );
334
+ $ driver = $ this -> driver ;
334
335
335
336
switch (true ) {
336
- case 'pgsql ' === $ driver && str_contains ( $ exception ->getMessage (), ' 42P01 ' ):
337
+ case 'pgsql ' === $ driver && ' 42P01 ' === $ exception ->getSQLState ( ):
337
338
case 'sqlite ' === $ driver && str_contains ($ exception ->getMessage (), 'no such table: ' ):
338
- case 'oci ' === $ driver && 942 === $ code :
339
- case 'sqlsrv ' === $ driver && 208 === $ code :
340
- case 'mysql ' === $ driver && 1146 === $ code :
339
+ case 'oci ' === $ driver && 942 === $ exception -> getCode () :
340
+ case 'sqlsrv ' === $ driver && 208 === $ exception -> getCode () :
341
+ case 'mysql ' === $ driver && 1146 === $ exception -> getCode () :
341
342
return true ;
342
343
default :
343
344
return false ;
You can’t perform that action at this time.
0 commit comments