Skip to content

Commit a47cd1b

Browse files
authored
Merge pull request #30998 from themsaid/pr/16983
[6.x] Prevent making actual pdo connections while reconnecting
2 parents 0b748bc + 6714637 commit a47cd1b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/Illuminate/Database/Connection.php

+20
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,16 @@ public function getPdo()
927927
return $this->pdo;
928928
}
929929

930+
/**
931+
* Get the raw current PDO connection parameter.
932+
*
933+
* @return \PDO|\Closure|null
934+
*/
935+
public function getRawPdo()
936+
{
937+
return $this->pdo;
938+
}
939+
930940
/**
931941
* Get the current PDO connection used for reading.
932942
*
@@ -949,6 +959,16 @@ public function getReadPdo()
949959
return $this->readPdo ?: $this->getPdo();
950960
}
951961

962+
/**
963+
* Get the raw current read PDO connection parameter.
964+
*
965+
* @return \PDO|\Closure|null
966+
*/
967+
public function getRawReadPdo()
968+
{
969+
return $this->readPdo;
970+
}
971+
952972
/**
953973
* Set the PDO connection.
954974
*

src/Illuminate/Database/DatabaseManager.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ protected function refreshPdoConnections($name)
256256
$fresh = $this->makeConnection($name);
257257

258258
return $this->connections[$name]
259-
->setPdo($fresh->getPdo())
260-
->setReadPdo($fresh->getReadPdo());
259+
->setPdo($fresh->getRawPdo())
260+
->setReadPdo($fresh->getRawReadPdo());
261261
}
262262

263263
/**

0 commit comments

Comments
 (0)