BUG Infinite loops in TempDatabase (fixes #8902)

Ugly, but so is the original implementation that this works around (swallowing an exception to trigger functionality)
This commit is contained in:
Ingo Schommer 2020-04-08 13:58:02 +12:00
parent bcab982aa7
commit 052c5cbc38

View File

@ -24,6 +24,13 @@ class TempDatabase
*/
protected $name = null;
/**
* Workaround to avoid infinite loops.
*
* @var Exception
*/
private $skippedException = null;
/**
* Optionally remove the test DB when the PHP process exits
*
@ -293,6 +300,13 @@ class TempDatabase
try {
$this->rebuildTables($extraDataObjects);
} catch (DatabaseException $ex) {
// Avoid infinite loops
if ($this->skippedException && $this->skippedException->getMessage() == $ex->getMessage()) {
throw $ex;
}
$this->skippedException = $ex;
// In case of error during build force a hard reset
// e.g. pgsql doesn't allow schema updates inside transactions
$this->kill();